Search in sources :

Example 11 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class AgentServiceImpl method getActiveThreadCount.

@Override
public AgentActiveThreadCountList getActiveThreadCount(List<AgentInfo> agentInfoList, byte[] payload) throws TException {
    AgentActiveThreadCountList activeThreadCountList = new AgentActiveThreadCountList(agentInfoList.size());
    Map<AgentInfo, PinpointRouteResponse> responseList = invoke(agentInfoList, payload);
    for (Map.Entry<AgentInfo, PinpointRouteResponse> entry : responseList.entrySet()) {
        AgentInfo agentInfo = entry.getKey();
        PinpointRouteResponse response = entry.getValue();
        AgentActiveThreadCount activeThreadCount = createActiveThreadCount(agentInfo.getAgentId(), response);
        activeThreadCountList.add(activeThreadCount);
    }
    return activeThreadCountList;
}
Also used : AgentActiveThreadCount(com.navercorp.pinpoint.web.vo.AgentActiveThreadCount) AgentActiveThreadCountList(com.navercorp.pinpoint.web.vo.AgentActiveThreadCountList) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) PinpointRouteResponse(com.navercorp.pinpoint.web.cluster.PinpointRouteResponse) FailedPinpointRouteResponse(com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse) DefaultPinpointRouteResponse(com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class AgentServiceImpl method invoke.

@Override
public Map<AgentInfo, PinpointRouteResponse> invoke(List<AgentInfo> agentInfoList, byte[] payload, long timeout) throws TException {
    Map<AgentInfo, Future<ResponseMessage>> futureMap = new HashMap<>();
    for (AgentInfo agentInfo : agentInfoList) {
        TCommandTransfer transferObject = createCommandTransferObject(agentInfo, payload);
        PinpointSocket socket = clusterManager.getSocket(agentInfo);
        if (socket != null) {
            Future<ResponseMessage> future = socket.request(serializeRequest(transferObject));
            futureMap.put(agentInfo, future);
        } else {
            futureMap.put(agentInfo, null);
        }
    }
    long startTime = System.currentTimeMillis();
    Map<AgentInfo, PinpointRouteResponse> result = new HashMap<>();
    for (Map.Entry<AgentInfo, Future<ResponseMessage>> futureEntry : futureMap.entrySet()) {
        AgentInfo agentInfo = futureEntry.getKey();
        Future<ResponseMessage> future = futureEntry.getValue();
        PinpointRouteResponse response = getResponse(future, getTimeoutMillis(startTime, timeout));
        result.put(agentInfo, response);
    }
    return result;
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) HashMap(java.util.HashMap) ResponseMessage(com.navercorp.pinpoint.rpc.ResponseMessage) PinpointSocket(com.navercorp.pinpoint.rpc.PinpointSocket) Future(com.navercorp.pinpoint.rpc.Future) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) PinpointRouteResponse(com.navercorp.pinpoint.web.cluster.PinpointRouteResponse) FailedPinpointRouteResponse(com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse) DefaultPinpointRouteResponse(com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Example 13 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class ApplicationAgentHostListSerializer method writeAgentList.

private void writeAgentList(List<AgentInfo> agentInfoList, JsonGenerator jsonGenerator) throws IOException {
    for (AgentInfo agentInfo : agentInfoList) {
        jsonGenerator.writeStartObject();
        writeAgent(agentInfo, jsonGenerator);
        jsonGenerator.writeEndObject();
    }
}
Also used : AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 14 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class ApplicationAgentListSerializer method writeAgentList.

private void writeAgentList(JsonGenerator jgen, List<AgentInfo> agentList) throws IOException {
    jgen.writeStartArray();
    for (AgentInfo agentInfo : agentList) {
        jgen.writeObject(agentInfo);
    }
    jgen.writeEndArray();
}
Also used : AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 15 with AgentInfo

use of com.navercorp.pinpoint.web.vo.AgentInfo in project pinpoint by naver.

the class ServerInstanceListTest method testGetAgentIdList.

@Test
public void testGetAgentIdList() throws Exception {
    AgentInfo agentInfo1 = createAgentInfo("agentId1", "testHost");
    AgentInfo agentInfo2 = createAgentInfo("agentId2", "testHost");
    Set<AgentInfo> agentInfoSet = new HashSet<>();
    agentInfoSet.add(agentInfo1);
    agentInfoSet.add(agentInfo2);
    ServerBuilder builder = new ServerBuilder();
    builder.addAgentInfo(agentInfoSet);
    ServerInstanceList serverInstanceList = builder.build();
    List<String> agentIdList = serverInstanceList.getAgentIdList();
    Assert.assertThat(agentIdList, hasSize(2));
    Assert.assertThat(agentIdList, hasItem("agentId1"));
    Assert.assertThat(agentIdList, hasItem("agentId2"));
}
Also used : AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)25 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)7 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)5 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 AgentLifeCycleBo (com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo)4 Scan (org.apache.hadoop.hbase.client.Scan)4 ResultsExtractor (com.navercorp.pinpoint.common.hbase.ResultsExtractor)3 AgentLifeCycleState (com.navercorp.pinpoint.common.server.util.AgentLifeCycleState)3 ArrayList (java.util.ArrayList)3 TableName (org.apache.hadoop.hbase.TableName)3 TException (org.apache.thrift.TException)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 DefaultPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse)2 FailedPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse)2 AgentActiveThreadDumpFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory)2 AgentActiveThreadDumpList (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList)2 ApplicationAgentHostList (com.navercorp.pinpoint.web.vo.ApplicationAgentHostList)2