Search in sources :

Example 11 with Histogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.Histogram 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;
}
Also used : AgentTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) ApplicationTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder) HashMap(java.util.HashMap) LinkCallDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Application(com.navercorp.pinpoint.web.vo.Application)

Aggregations

Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)11 Test (org.junit.Test)4 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)3 TimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram)3 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)3 HashMap (java.util.HashMap)3 HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)2 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)2 Application (com.navercorp.pinpoint.web.vo.Application)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)1 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)1 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)1 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)1 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)1