Search in sources :

Example 1 with ApplicationAgentList

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

the class AgentCountReader method beforeStep.

@Override
public void beforeStep(StepExecution stepExecution) {
    ApplicationAgentList applicationAgentList = agentInfoService.getApplicationAgentList(ApplicationAgentList.Key.APPLICATION_NAME);
    queue.add(applicationAgentList);
}
Also used : ApplicationAgentList(com.navercorp.pinpoint.web.vo.ApplicationAgentList)

Example 2 with ApplicationAgentList

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

the class AgentInfoServiceImpl method getApplicationAgentList.

@Override
public ApplicationAgentList getApplicationAgentList(ApplicationAgentList.Key applicationAgentListKey, String applicationName, long timestamp) {
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }
    if (applicationAgentListKey == null) {
        throw new NullPointerException("applicationAgentListKey must not be null");
    }
    final List<String> agentIdList = this.applicationIndexDao.selectAgentIds(applicationName);
    if (logger.isDebugEnabled()) {
        logger.debug("agentIdList={}", agentIdList);
    }
    if (CollectionUtils.isEmpty(agentIdList)) {
        logger.debug("agentIdList is empty. applicationName={}", applicationName);
        return new ApplicationAgentList(new TreeMap<String, List<AgentInfo>>());
    }
    // key = hostname
    // value= list fo agentinfo
    SortedMap<String, List<AgentInfo>> result = new TreeMap<>();
    List<AgentInfo> agentInfos = this.agentInfoDao.getAgentInfos(agentIdList, timestamp);
    this.agentLifeCycleDao.populateAgentStatuses(agentInfos, timestamp);
    for (AgentInfo agentInfo : agentInfos) {
        if (agentInfo != null) {
            String hostname = applicationAgentListKey.getKey(agentInfo);
            if (result.containsKey(hostname)) {
                result.get(hostname).add(agentInfo);
            } else {
                List<AgentInfo> list = new ArrayList<>();
                list.add(agentInfo);
                result.put(hostname, list);
            }
        }
    }
    for (List<AgentInfo> agentInfoList : result.values()) {
        Collections.sort(agentInfoList, AgentInfo.AGENT_NAME_ASC_COMPARATOR);
    }
    logger.info("getApplicationAgentList={}", result);
    return new ApplicationAgentList(result);
}
Also used : ApplicationAgentList(com.navercorp.pinpoint.web.vo.ApplicationAgentList) ArrayList(java.util.ArrayList) ApplicationAgentList(com.navercorp.pinpoint.web.vo.ApplicationAgentList) ArrayList(java.util.ArrayList) ApplicationAgentHostList(com.navercorp.pinpoint.web.vo.ApplicationAgentHostList) List(java.util.List) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) TreeMap(java.util.TreeMap)

Example 3 with ApplicationAgentList

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

the class AgentInfoServiceImpl method getApplicationAgentList.

@Override
public ApplicationAgentList getApplicationAgentList(ApplicationAgentList.Key key, long timestamp) {
    ApplicationAgentList applicationAgentList = new ApplicationAgentList();
    List<Application> applications = applicationIndexDao.selectAllApplicationNames();
    for (Application application : applications) {
        applicationAgentList.merge(this.getApplicationAgentList(key, application.getName(), timestamp));
    }
    return applicationAgentList;
}
Also used : ApplicationAgentList(com.navercorp.pinpoint.web.vo.ApplicationAgentList) Application(com.navercorp.pinpoint.web.vo.Application)

Example 4 with ApplicationAgentList

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

the class ApplicationAgentsListSerializer method serialize.

@Override
public void serialize(ApplicationAgentsList applicationAgentsList, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    List<ApplicationAgentList> applicationAgentLists = applicationAgentsList.getApplicationAgentLists();
    for (ApplicationAgentList applicationAgentList : applicationAgentLists) {
        jgen.writeFieldName(applicationAgentList.getGroupName());
        writeAgentList(jgen, applicationAgentList.getAgentInfos());
    }
    jgen.writeEndObject();
}
Also used : ApplicationAgentList(com.navercorp.pinpoint.web.vo.ApplicationAgentList)

Aggregations

ApplicationAgentList (com.navercorp.pinpoint.web.vo.ApplicationAgentList)4 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 Application (com.navercorp.pinpoint.web.vo.Application)1 ApplicationAgentHostList (com.navercorp.pinpoint.web.vo.ApplicationAgentHostList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TreeMap (java.util.TreeMap)1