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;
}
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;
}
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();
}
}
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();
}
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"));
}
Aggregations