use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCount in project pinpoint by naver.
the class ActiveThreadCountResponseAggregator method flush.
@Override
public void flush(Executor executor) throws Exception {
if ((flushCount.getAndIncrement() % LOG_RECORD_RATE) == 0) {
logger.info("flush started. applicationName:{}", applicationName);
}
if (isStopped) {
return;
}
AgentActiveThreadCountList response = new AgentActiveThreadCountList();
synchronized (aggregatorLock) {
for (ActiveThreadCountWorker activeThreadCountWorker : activeThreadCountWorkerRepository.values()) {
String agentId = activeThreadCountWorker.getAgentId();
AgentActiveThreadCount agentActiveThreadCount = activeThreadCountMap.get(agentId);
if (agentActiveThreadCount != null) {
response.add(agentActiveThreadCount);
} else {
response.add(activeThreadCountWorker.getDefaultFailResponse());
}
}
activeThreadCountMap = new HashMap<>(activeThreadCountWorkerRepository.size());
}
TextMessage webSocketTextMessage = createWebSocketTextMessage(response);
if (webSocketTextMessage != null) {
if (executor == null) {
flush0(webSocketTextMessage);
} else {
flushAsync0(webSocketTextMessage, executor);
}
}
}
use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCount in project pinpoint by naver.
the class ActiveThreadCountWorker method setDefaultErrorMessage.
private void setDefaultErrorMessage(String message) {
ActiveThreadCountErrorType errorType = ActiveThreadCountErrorType.getType(message);
AgentActiveThreadCount failResponse = failResponseFactory.createFail(errorType.getCode(), errorType.getMessage());
defaultFailResponse = failResponse;
}
use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCount in project pinpoint by naver.
the class AgentActiveThreadCountListSerializer method serialize.
@Override
public void serialize(AgentActiveThreadCountList agentActiveThreadStatusList, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
List<AgentActiveThreadCount> agentActiveThreadRepository = agentActiveThreadStatusList.getAgentActiveThreadRepository();
jgen.writeStartObject();
for (AgentActiveThreadCount agentActiveThread : agentActiveThreadRepository) {
jgen.writeFieldName(agentActiveThread.getAgentId());
jgen.writeStartObject();
jgen.writeNumberField("code", agentActiveThread.getCode());
jgen.writeStringField("message", agentActiveThread.getCodeMessage());
List<Integer> activeThreadCountList = agentActiveThread.getActiveThreadCountList();
if (CollectionUtils.nullSafeSize(activeThreadCountList) == 4) {
jgen.writeFieldName("status");
jgen.writeStartArray();
jgen.writeNumber(activeThreadCountList.get(0));
jgen.writeNumber(activeThreadCountList.get(1));
jgen.writeNumber(activeThreadCountList.get(2));
jgen.writeNumber(activeThreadCountList.get(3));
jgen.writeEndArray();
}
jgen.writeEndObject();
}
jgen.writeEndObject();
}
use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCount 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;
}
Aggregations