Search in sources :

Example 1 with ClusterPoint

use of com.navercorp.pinpoint.collector.cluster.ClusterPoint in project pinpoint by naver.

the class ClusterPointController method getGrpcAgentConnectionList.

private List<GrpcAgentConnection> getGrpcAgentConnectionList(final String applicationName, final String agentId, final long startTimestamp) {
    Objects.requireNonNull(applicationName, "applicationName");
    List<GrpcAgentConnection> result = new ArrayList<>();
    List<ClusterPoint<?>> clusterPointList = clusterPointLocator.getClusterPointList();
    for (ClusterPoint<?> clusterPoint : clusterPointList) {
        if (!(clusterPoint instanceof GrpcAgentConnection)) {
            continue;
        }
        AgentInfo destAgentInfo = clusterPoint.getDestAgentInfo();
        if (!destAgentInfo.getApplicationName().equals(applicationName)) {
            continue;
        }
        if (StringUtils.hasText(agentId) && !destAgentInfo.getAgentId().equals(agentId)) {
            continue;
        }
        if (startTimestamp > 0 && destAgentInfo.getStartTimestamp() != startTimestamp) {
            continue;
        }
        result.add((GrpcAgentConnection) clusterPoint);
    }
    return result;
}
Also used : GrpcAgentConnection(com.navercorp.pinpoint.collector.cluster.GrpcAgentConnection) ArrayList(java.util.ArrayList) AgentInfo(com.navercorp.pinpoint.collector.cluster.AgentInfo) ClusterPoint(com.navercorp.pinpoint.collector.cluster.ClusterPoint)

Example 2 with ClusterPoint

use of com.navercorp.pinpoint.collector.cluster.ClusterPoint in project pinpoint by naver.

the class AbstractRouteHandler method findClusterPoint.

protected ClusterPoint<?> findClusterPoint(TCommandTransfer deliveryCommand) {
    String applicationName = deliveryCommand.getApplicationName();
    String agentId = deliveryCommand.getAgentId();
    long startTimeStamp = deliveryCommand.getStartTime();
    List<ClusterPoint<?>> result = new ArrayList<>();
    for (ClusterPoint<?> targetClusterPoint : targetClusterPointLocator.getClusterPointList()) {
        AgentInfo destAgentInfo = targetClusterPoint.getDestAgentInfo();
        if (destAgentInfo.equals(applicationName, agentId, startTimeStamp)) {
            result.add(targetClusterPoint);
        }
    }
    if (result.size() == 1) {
        return result.get(0);
    }
    if (result.size() > 1) {
        logger.warn("Ambiguous ClusterPoint {}, {}, {} (Valid Agent list={}).", applicationName, agentId, startTimeStamp, result);
        return null;
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) AgentInfo(com.navercorp.pinpoint.collector.cluster.AgentInfo) ClusterPoint(com.navercorp.pinpoint.collector.cluster.ClusterPoint)

Aggregations

AgentInfo (com.navercorp.pinpoint.collector.cluster.AgentInfo)2 ClusterPoint (com.navercorp.pinpoint.collector.cluster.ClusterPoint)2 ArrayList (java.util.ArrayList)2 GrpcAgentConnection (com.navercorp.pinpoint.collector.cluster.GrpcAgentConnection)1