use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.
the class ApplicationMapBuilder method build.
public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final AgentInfoService agentInfoService, final ResponseHistogramBuilder mapHistogramSummary) {
AgentInfoPopulator agentInfoPopulator = new AgentInfoPopulator() {
@Override
public void addAgentInfos(Node node) {
ServerInstanceList serverInstanceList = getServerInstanceList(node, agentInfoService);
node.setServerInstanceList(serverInstanceList);
}
};
NodeHistogramDataSource responseSource = new NodeHistogramDataSource() {
@Override
public NodeHistogram createNodeHistogram(Application application) {
List<ResponseTime> responseHistogram = mapHistogramSummary.getResponseTimeList(application);
final NodeHistogram nodeHistogram = new NodeHistogram(application, range, responseHistogram);
return nodeHistogram;
}
};
return this.build(linkDataDuplexMap, agentInfoPopulator, responseSource);
}
use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.
the class ApplicationMapBuilder method filterAgentInfoByResponseData.
/**
* 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.
*/
private Set<AgentInfo> filterAgentInfoByResponseData(Set<AgentInfo> agentList, long timestamp, Node node, AgentInfoService agentInfoService) {
Set<AgentInfo> filteredAgentInfo = new HashSet<>();
NodeHistogram nodeHistogram = node.getNodeHistogram();
Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
for (AgentInfo agentInfo : agentList) {
String agentId = agentInfo.getAgentId();
if (agentHistogramMap.containsKey(agentId)) {
filteredAgentInfo.add(agentInfo);
} else {
AgentStatus status = agentInfoService.getAgentStatus(agentId, timestamp);
agentInfo.setStatus(status);
if (isAgentRunning(agentInfo)) {
filteredAgentInfo.add(agentInfo);
}
}
}
return filteredAgentInfo;
}
use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.
the class ApplicationMapBuilder method appendNodeResponseTime.
public void appendNodeResponseTime(NodeList nodeList, LinkList linkList, NodeHistogramDataSource nodeHistogramDataSource) {
if (nodeHistogramDataSource == null) {
throw new NullPointerException("nodeHistogramDataSource must not be null");
}
final Collection<Node> nodes = nodeList.getNodeList();
for (Node node : nodes) {
final ServiceType nodeType = node.getServiceType();
if (nodeType.isWas()) {
// for WAS nodes, set their own response time histogram
final Application wasNode = node.getApplication();
final NodeHistogram nodeHistogram = nodeHistogramDataSource.createNodeHistogram(wasNode);
node.setNodeHistogram(nodeHistogram);
} else if (nodeType.isTerminal() || nodeType.isUnknown()) {
final NodeHistogram nodeHistogram = createTerminalNodeHistogram(node, linkList);
node.setNodeHistogram(nodeHistogram);
} else if (nodeType.isQueue()) {
// Virtual queue node - queues with agent installed will be handled above as a WAS node
final NodeHistogram nodeHistogram = createTerminalNodeHistogram(node, linkList);
node.setNodeHistogram(nodeHistogram);
} else if (nodeType.isUser()) {
// for User nodes, find its source link and create the histogram
Application userNode = node.getApplication();
final NodeHistogram nodeHistogram = new NodeHistogram(userNode, range);
final List<Link> fromLink = linkList.findFromLink(userNode);
if (fromLink.size() > 1) {
// used first(0) link.
logger.warn("Invalid from UserNode:{}", linkList.getLinkList());
} else if (fromLink.isEmpty()) {
logger.warn("from UserNode not found:{}", userNode);
continue;
}
final Link sourceLink = fromLink.get(0);
nodeHistogram.setApplicationHistogram(sourceLink.getHistogram());
ApplicationTimeHistogram histogramData = sourceLink.getTargetApplicationTimeSeriesHistogramData();
nodeHistogram.setApplicationTimeHistogram(histogramData);
node.setNodeHistogram(nodeHistogram);
} else {
// dummy data
NodeHistogram dummy = new NodeHistogram(node.getApplication(), range);
node.setNodeHistogram(dummy);
}
}
}
use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.
the class ApplicationMapBuilder method build.
public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final AgentInfoService agentInfoService, final MapResponseDao mapResponseDao) {
AgentInfoPopulator agentInfoPopulator = new AgentInfoPopulator() {
@Override
public void addAgentInfos(Node node) {
ServerInstanceList serverInstanceList = getServerInstanceList(node, agentInfoService);
node.setServerInstanceList(serverInstanceList);
}
};
NodeHistogramDataSource responseSource = new NodeHistogramDataSource() {
@Override
public NodeHistogram createNodeHistogram(Application application) {
final List<ResponseTime> responseHistogram = mapResponseDao.selectResponseTime(application, range);
final NodeHistogram nodeHistogram = new NodeHistogram(application, range, responseHistogram);
return nodeHistogram;
}
};
return this.build(linkDataDuplexMap, agentInfoPopulator, responseSource);
}
use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.
the class NodeSerializer method writeHistogram.
private void writeHistogram(JsonGenerator jgen, Node node) throws IOException {
final ServiceType serviceType = node.getServiceType();
final NodeHistogram nodeHistogram = node.getNodeHistogram();
// FIXME isn't this all ServiceTypes that can be a node?
if (serviceType.isWas() || serviceType.isTerminal() || serviceType.isUnknown() || serviceType.isUser() || serviceType.isQueue()) {
Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
if (applicationHistogram == null) {
writeEmptyObject(jgen, "histogram");
// for go.js
jgen.writeBooleanField("hasAlert", false);
} else {
jgen.writeObjectField("histogram", applicationHistogram);
// for go.js
jgen.writeNumberField("totalCount", applicationHistogram.getTotalCount());
jgen.writeNumberField("errorCount", applicationHistogram.getTotalErrorCount());
jgen.writeNumberField("slowCount", applicationHistogram.getSlowCount());
if (applicationHistogram.getTotalCount() == 0) {
// for go.js
jgen.writeBooleanField("hasAlert", false);
} else {
long error = applicationHistogram.getTotalErrorCount() / applicationHistogram.getTotalCount();
if (error * 100 > 10) {
// for go.js
jgen.writeBooleanField("hasAlert", true);
} else {
// for go.js
jgen.writeBooleanField("hasAlert", false);
}
}
}
Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
if (agentHistogramMap == null) {
writeEmptyObject(jgen, "agentHistogram");
} else {
jgen.writeObjectField("agentHistogram", agentHistogramMap);
}
} else {
// for go.js
jgen.writeBooleanField("hasAlert", false);
}
// FIXME isn't this all ServiceTypes that can be a node?
if (serviceType.isWas() || serviceType.isUser() || serviceType.isTerminal() || serviceType.isUnknown() || serviceType.isQueue()) {
List<ResponseTimeViewModel> applicationTimeSeriesHistogram = nodeHistogram.getApplicationTimeHistogram();
if (applicationTimeSeriesHistogram == null) {
writeEmptyArray(jgen, "timeSeriesHistogram");
} else {
jgen.writeObjectField("timeSeriesHistogram", applicationTimeSeriesHistogram);
}
AgentResponseTimeViewModelList agentTimeSeriesHistogram = nodeHistogram.getAgentTimeHistogram();
jgen.writeObject(agentTimeSeriesHistogram);
}
}
Aggregations