Search in sources :

Example 1 with AgentActiveThreadCountList

use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCountList 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 AgentActiveThreadCountList

use of com.navercorp.pinpoint.web.vo.AgentActiveThreadCountList 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)2 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