use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.
the class AgentTimeHistogram method createViewModel.
public List<AgentResponseTimeViewModel> createViewModel(TimeHistogramFormat timeHistogramFormat) {
final List<AgentResponseTimeViewModel> result = new ArrayList<>();
for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
Application agentId = agentHistogram.getAgentId();
List<TimeHistogram> timeList = sortTimeHistogram(agentHistogram.getTimeHistogram());
AgentResponseTimeViewModel model = createAgentResponseTimeViewModel(agentId, timeList, timeHistogramFormat);
result.add(model);
}
result.sort(Comparator.comparing(AgentResponseTimeViewModel::getAgentName));
return result;
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.
the class AgentTimeHistogramBuilder method interpolation.
private AgentHistogramList interpolation(AgentHistogramList agentHistogramList, TimeWindow window) {
if (agentHistogramList.size() == 0) {
return new AgentHistogramList();
}
// create window space. Prior to using a AgentHistogramList, we used a raw data structure.
// could've been a list, but since range overflow may occur when applying filters, we use a map instead.
// TODO: find better structure
final AgentHistogramList resultAgentHistogramList = new AgentHistogramList();
for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
List<TimeHistogram> timeHistogramList = new ArrayList<>();
for (Long time : window) {
timeHistogramList.add(new TimeHistogram(application.getServiceType(), time));
}
resultAgentHistogramList.addTimeHistogram(agentHistogram.getAgentId(), timeHistogramList);
}
for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
for (TimeHistogram timeHistogram : agentHistogram.getTimeHistogram()) {
final Long time = window.refineTimestamp(timeHistogram.getTimeStamp());
Application agentId = agentHistogram.getAgentId();
TimeHistogram windowHistogram = new TimeHistogram(timeHistogram.getHistogramSchema(), time);
windowHistogram.add(timeHistogram);
resultAgentHistogramList.addTimeHistogram(agentId, windowHistogram);
}
}
return resultAgentHistogramList;
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.
the class LinkSerializer method writeAgentHistogram.
private void writeAgentHistogram(String fieldName, AgentHistogramList agentHistogramList, JsonGenerator jgen) throws IOException {
jgen.writeFieldName(fieldName);
jgen.writeStartObject();
for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
jgen.writeFieldName(agentHistogram.getId());
jgen.writeObject(agentHistogram.getHistogram());
}
jgen.writeEndObject();
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.
the class ApplicationMapBuilder method createTerminalNodeHistogram.
private NodeHistogram createTerminalNodeHistogram(Node node, LinkList linkList) {
// for Terminal nodes, add all links pointing to iself and create the histogram
final Application nodeApplication = node.getApplication();
final NodeHistogram nodeHistogram = new NodeHistogram(nodeApplication, range);
// create applicationHistogram
final List<Link> toLinkList = linkList.findToLink(nodeApplication);
final Histogram applicationHistogram = new Histogram(node.getServiceType());
for (Link link : toLinkList) {
applicationHistogram.add(link.getHistogram());
}
nodeHistogram.setApplicationHistogram(applicationHistogram);
// create applicationTimeHistogram
LinkCallDataMap linkCallDataMap = new LinkCallDataMap();
for (Link link : toLinkList) {
LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap();
linkCallDataMap.addLinkDataMap(sourceLinkCallDataMap);
}
ApplicationTimeHistogramBuilder builder = new ApplicationTimeHistogramBuilder(nodeApplication, range);
ApplicationTimeHistogram applicationTimeHistogram = builder.build(linkCallDataMap.getLinkDataList());
nodeHistogram.setApplicationTimeHistogram(applicationTimeHistogram);
// for Terminal nodes, create AgentLevel histogram
if (nodeApplication.getServiceType().isTerminal() || nodeApplication.getServiceType().isQueue()) {
final Map<String, Histogram> agentHistogramMap = new HashMap<>();
for (Link link : toLinkList) {
LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap();
AgentHistogramList targetList = sourceLinkCallDataMap.getTargetList();
for (AgentHistogram histogram : targetList.getAgentHistogramList()) {
Histogram find = agentHistogramMap.get(histogram.getId());
if (find == null) {
find = new Histogram(histogram.getServiceType());
agentHistogramMap.put(histogram.getId(), find);
}
find.add(histogram.getHistogram());
}
nodeHistogram.setAgentHistogramMap(agentHistogramMap);
}
}
LinkCallDataMap mergeSource = new LinkCallDataMap();
for (Link link : toLinkList) {
LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap();
mergeSource.addLinkDataMap(sourceLinkCallDataMap);
}
AgentTimeHistogramBuilder agentTimeBuilder = new AgentTimeHistogramBuilder(nodeApplication, range);
AgentTimeHistogram agentTimeHistogram = agentTimeBuilder.buildTarget(mergeSource);
nodeHistogram.setAgentTimeHistogram(agentTimeHistogram);
return nodeHistogram;
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.
the class ServerBuilder method buildLogicalServer.
/**
* filled with application information of physical server and service instance
*
* @param hostHistogram
*/
public ServerInstanceList buildLogicalServer(final AgentHistogramList hostHistogram) {
ServerInstanceList serverInstanceList = new ServerInstanceList();
for (AgentHistogram agentHistogram : hostHistogram.getAgentHistogramList()) {
final String instanceName = agentHistogram.getId();
final String hostName = getHostName(agentHistogram.getId());
final ServiceType serviceType = agentHistogram.getServiceType();
final ServerInstance serverInstance = new ServerInstance(hostName, instanceName, serviceType.getCode());
serverInstanceList.addServerInstance(serverInstance);
}
return serverInstanceList;
}
Aggregations