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