Search in sources :

Example 1 with AgentHistogramList

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList 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;
}
Also used : AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Application(com.navercorp.pinpoint.web.vo.Application) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)

Example 2 with AgentHistogramList

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList in project pinpoint by naver.

the class LinkSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    AgentHistogramList list = new AgentHistogramList();
    AgentHistogram histogram = new AgentHistogram(new Application("test", ServiceType.STAND_ALONE));
    list.addAgentHistogram(histogram);
    Node node1 = new Node(new Application("test1", ServiceType.STAND_ALONE));
    Node node2 = new Node(new Application("test1", ServiceType.STAND_ALONE));
    Link link = new Link(CreateType.Source, node1, node2, new Range(0, 1));
    ObjectWriter objectWriter = MAPPER.writerWithDefaultPrettyPrinter();
    String s = objectWriter.writeValueAsString(link);
    logger.debug(s);
}
Also used : Node(com.navercorp.pinpoint.web.applicationmap.Node) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) Link(com.navercorp.pinpoint.web.applicationmap.Link) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) Test(org.junit.Test)

Example 3 with AgentHistogramList

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList 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)

Example 4 with AgentHistogramList

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList in project pinpoint by naver.

the class AgentTimeHistogramBuilder method build.

private AgentTimeHistogram build(AgentHistogramList agentHistogramList) {
    AgentHistogramList histogramList = interpolation(agentHistogramList, window);
    AgentTimeHistogram agentTimeHistogram = new AgentTimeHistogram(application, range, histogramList);
    return agentTimeHistogram;
}
Also used : AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)

Aggregations

AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)4 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)3 Application (com.navercorp.pinpoint.web.vo.Application)3 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 Link (com.navercorp.pinpoint.web.applicationmap.Link)1 Node (com.navercorp.pinpoint.web.applicationmap.Node)1 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)1 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)1 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)1 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)1 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)1 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)1 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)1 Range (com.navercorp.pinpoint.web.vo.Range)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1