Search in sources :

Example 1 with AgentActiveThreadCount

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);
        }
    }
}
Also used : AgentActiveThreadCount(com.navercorp.pinpoint.web.vo.AgentActiveThreadCount) AgentActiveThreadCountList(com.navercorp.pinpoint.web.vo.AgentActiveThreadCountList) TextMessage(org.springframework.web.socket.TextMessage)

Example 2 with AgentActiveThreadCount

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;
}
Also used : AgentActiveThreadCount(com.navercorp.pinpoint.web.vo.AgentActiveThreadCount)

Example 3 with AgentActiveThreadCount

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();
}
Also used : AgentActiveThreadCount(com.navercorp.pinpoint.web.vo.AgentActiveThreadCount)

Example 4 with AgentActiveThreadCount

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;
}
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)

Aggregations

AgentActiveThreadCount (com.navercorp.pinpoint.web.vo.AgentActiveThreadCount)4 AgentActiveThreadCountList (com.navercorp.pinpoint.web.vo.AgentActiveThreadCountList)2 DefaultPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse)1 FailedPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse)1 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)1 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TextMessage (org.springframework.web.socket.TextMessage)1