mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-13 23:06:54 +10:00
Add method, that get scatter data made of dot group . #1518
added serverList value in getFilteredServerMapDataMadeOfDotGroup api result.
This commit is contained in:
+51
-25
@@ -18,16 +18,36 @@ package com.navercorp.pinpoint.web.applicationmap;
|
||||
|
||||
import com.navercorp.pinpoint.common.trace.ServiceType;
|
||||
import com.navercorp.pinpoint.common.util.AgentLifeCycleState;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.*;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.*;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.Histogram;
|
||||
import com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap;
|
||||
import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap;
|
||||
import com.navercorp.pinpoint.web.dao.MapResponseDao;
|
||||
import com.navercorp.pinpoint.web.service.AgentInfoService;
|
||||
import com.navercorp.pinpoint.web.vo.*;
|
||||
|
||||
import com.navercorp.pinpoint.web.vo.AgentInfo;
|
||||
import com.navercorp.pinpoint.web.vo.AgentStatus;
|
||||
import com.navercorp.pinpoint.web.vo.Application;
|
||||
import com.navercorp.pinpoint.web.vo.LinkKey;
|
||||
import com.navercorp.pinpoint.web.vo.Range;
|
||||
import com.navercorp.pinpoint.web.vo.ResponseHistogramBuilder;
|
||||
import com.navercorp.pinpoint.web.vo.ResponseTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
@@ -100,21 +120,7 @@ public class ApplicationMapBuilder {
|
||||
AgentInfoPopulator agentInfoPopulator = new AgentInfoPopulator() {
|
||||
@Override
|
||||
public void addAgentInfos(Node node) {
|
||||
long timestamp = range.getTo();
|
||||
Set<AgentInfo> agentList = agentInfoService.getAgentsByApplicationNameWithoutStatus(node.getApplication().getName(), timestamp);
|
||||
if (agentList.isEmpty()) {
|
||||
logger.warn("agentInfo not found. applicationName:{}", node.getApplication());
|
||||
// avoid NPE
|
||||
node.setServerInstanceList(new ServerInstanceList());
|
||||
return;
|
||||
}
|
||||
logger.debug("add agentInfo. {}, {}", node.getApplication(), agentList);
|
||||
ServerBuilder builder = new ServerBuilder();
|
||||
agentList = filterAgentInfoByResponseData(agentList, timestamp, node, agentInfoService);
|
||||
builder.addAgentInfo(agentList);
|
||||
ServerInstanceList serverInstanceList = builder.build();
|
||||
|
||||
// agentSet exists if the destination is a WAS, and has agent installed
|
||||
ServerInstanceList serverInstanceList = getServerInstanceList(node, agentInfoService);
|
||||
node.setServerInstanceList(serverInstanceList);
|
||||
}
|
||||
};
|
||||
@@ -129,11 +135,31 @@ public class ApplicationMapBuilder {
|
||||
return this.build(linkDataDuplexMap, agentInfoPopulator, responseSource);
|
||||
}
|
||||
|
||||
public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final ResponseHistogramBuilder mapHistogramSummary) {
|
||||
AgentInfoPopulator emptyPopulator = new AgentInfoPopulator() {
|
||||
private ServerInstanceList getServerInstanceList(final Node node, final AgentInfoService agentInfoService) {
|
||||
long timestamp = range.getTo();
|
||||
Set<AgentInfo> agentList = agentInfoService.getAgentsByApplicationNameWithoutStatus(node.getApplication().getName(), timestamp);
|
||||
if (agentList.isEmpty()) {
|
||||
logger.warn("agentInfo not found. applicationName:{}", node.getApplication());
|
||||
// avoid NPE
|
||||
return new ServerInstanceList();
|
||||
}
|
||||
|
||||
logger.debug("add agentInfo. {}, {}", node.getApplication(), agentList);
|
||||
ServerBuilder builder = new ServerBuilder();
|
||||
|
||||
// agentSet exists if the destination is a WAS, and has agent installed
|
||||
agentList = filterAgentInfoByResponseData(agentList, timestamp, node, agentInfoService);
|
||||
builder.addAgentInfo(agentList);
|
||||
ServerInstanceList serverInstanceList = builder.build();
|
||||
return serverInstanceList;
|
||||
}
|
||||
|
||||
public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final AgentInfoService agentInfoService, final ResponseHistogramBuilder mapHistogramSummary) {
|
||||
AgentInfoPopulator agentInfoPopulator = new AgentInfoPopulator() {
|
||||
@Override
|
||||
public void addAgentInfos(Node node) {
|
||||
node.setServerInstanceList(new ServerInstanceList());
|
||||
ServerInstanceList serverInstanceList = getServerInstanceList(node, agentInfoService);
|
||||
node.setServerInstanceList(serverInstanceList);
|
||||
}
|
||||
};
|
||||
NodeHistogramDataSource responseSource = new NodeHistogramDataSource() {
|
||||
@@ -144,7 +170,7 @@ public class ApplicationMapBuilder {
|
||||
return nodeHistogram;
|
||||
}
|
||||
};
|
||||
return this.build(linkDataDuplexMap, emptyPopulator, responseSource);
|
||||
return this.build(linkDataDuplexMap, agentInfoPopulator, responseSource);
|
||||
}
|
||||
|
||||
public interface NodeHistogramDataSource {
|
||||
@@ -443,7 +469,7 @@ public class ApplicationMapBuilder {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filters AgentInfo by whether they actually have response data.
|
||||
* For agents that do not have response data, check their status and include those that were alive.
|
||||
|
||||
@@ -66,6 +66,9 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private AgentInfoService agentInfoService;
|
||||
|
||||
@Autowired
|
||||
private TraceDao traceDao;
|
||||
|
||||
@@ -337,7 +340,7 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
|
||||
ApplicationMapBuilder applicationMapBuilder = new ApplicationMapBuilder(range);
|
||||
mapHistogramSummary.build();
|
||||
ApplicationMap map = applicationMapBuilder.build(linkDataDuplexMap, mapHistogramSummary);
|
||||
ApplicationMap map = applicationMapBuilder.build(linkDataDuplexMap, agentInfoService, mapHistogramSummary);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user