Search in sources :

Example 1 with NodeList

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.

the class ResponseTimeHistogramServiceImpl method selectLinkHistogramData.

@Override
public LinkHistogramSummary selectLinkHistogramData(Application fromApplication, Application toApplication, Range range) {
    Objects.requireNonNull(fromApplication, "fromApplication");
    Objects.requireNonNull(toApplication, "toApplication");
    Objects.requireNonNull(range, "range");
    LinkDataDuplexMap linkDataDuplexMap;
    ServiceType fromApplicationServiceType = fromApplication.getServiceType();
    CreateType createType = CreateType.Target;
    // For user or queue originating links, we must scan using to applications
    if (fromApplicationServiceType.isUser() || fromApplicationServiceType.isQueue()) {
        createType = CreateType.Source;
        LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(fromApplication);
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
        linkDataDuplexMap = linkSelector.select(Collections.singletonList(toApplication), range, 0, 1);
    } else {
        LinkDataMapProcessor destinationApplication = new DestinationApplicationFilter(toApplication);
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplication, LinkDataMapProcessor.NO_OP);
        linkDataDuplexMap = linkSelector.select(Collections.singletonList(fromApplication), range, 1, 0);
    }
    NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
    LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, range);
    LinkKey linkKey = new LinkKey(fromApplication, toApplication);
    Link link = linkList.getLink(linkKey);
    if (link == null) {
        return createEmptyLinkHistogramSummary(createType, fromApplication, toApplication, range);
    }
    return new LinkHistogramSummary(link);
}
Also used : SourceApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.SourceApplicationFilter) LinkHistogramSummary(com.navercorp.pinpoint.web.applicationmap.link.LinkHistogramSummary) LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) LinkDataMapProcessor(com.navercorp.pinpoint.web.service.map.processor.LinkDataMapProcessor) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) CreateType(com.navercorp.pinpoint.web.applicationmap.link.CreateType) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) LinkSelector(com.navercorp.pinpoint.web.service.map.LinkSelector) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) DestinationApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter) Link(com.navercorp.pinpoint.web.applicationmap.link.Link)

Example 2 with NodeList

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.

the class ResponseTimeHistogramServiceImpl method selectNodeHistogramData.

@Override
public NodeHistogramSummary selectNodeHistogramData(ResponseTimeHistogramServiceOption option) {
    Node node = new Node(option.getApplication());
    ServiceType applicationServiceType = option.getApplication().getServiceType();
    List<Application> sourceApplications = option.getFromApplications();
    List<Application> destinationApplications = option.getToApplications();
    final NodeHistogramFactory nodeHistogramFactory = createNodeHistogramFactory();
    final ServerInstanceListFactory serverInstanceListFactory = createServerInstanceListFactory(option);
    if (applicationServiceType.isWas()) {
        NodeHistogram nodeHistogram = nodeHistogramFactory.createWasNodeHistogram(option.getApplication(), option.getRange());
        node.setNodeHistogram(nodeHistogram);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createWasNodeInstanceList(node, option.getRange().getTo());
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isTerminal() || applicationServiceType.isUnknown() || applicationServiceType.isAlias()) {
        if (sourceApplications.isEmpty()) {
            return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
        }
        LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createEmptyNodeInstanceList();
        if (applicationServiceType.isTerminal() || applicationServiceType.isAlias()) {
            serverInstanceList = serverInstanceListFactory.createTerminalNodeInstanceList(node, linkDataDuplexMap);
        }
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createTerminalNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isQueue()) {
        LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
        if (sourceApplications.isEmpty()) {
            if (destinationApplications.isEmpty()) {
                return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
            }
            // Retrieve callers
            LinkDataMapProcessor applicationFilter = new ApplicationFilter(option.getApplication());
            LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, applicationFilter);
            LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 0, 2);
            LinkDataMap linkDataMap = destinationApplicationFilter.processLinkDataMap(linkDataDuplexMap.getTargetLinkDataMap(), option.getRange());
            for (LinkData linkData : linkDataMap.getLinkDataList()) {
                sourceApplications.add(linkData.getFromApplication());
            }
        }
        // Check using from applications first for caller's link data
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createQueueNodeInstanceList(node, linkDataDuplexMap);
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createQueueNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isUser()) {
        if (destinationApplications.isEmpty()) {
            return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
        }
        LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(option.getApplication());
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(destinationApplications, option.getRange(), 0, 1);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createUserNodeInstanceList();
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createUserNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else {
        return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
    }
}
Also used : SourceApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.SourceApplicationFilter) ServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory) DefaultServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.DefaultServerInstanceListFactory) StatisticsServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.StatisticsServerInstanceListFactory) LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) LinkSelector(com.navercorp.pinpoint.web.service.map.LinkSelector) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) DestinationApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter) DefaultNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.DefaultNodeHistogramFactory) NodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) LinkDataMapProcessor(com.navercorp.pinpoint.web.service.map.processor.LinkDataMapProcessor) DestinationApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter) SourceApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.SourceApplicationFilter) ApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.ApplicationFilter) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Application(com.navercorp.pinpoint.web.vo.Application) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 3 with NodeList

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.

the class ApplicationMapBuilder method build.

public ApplicationMap build(Application application, long timeoutMillis) {
    logger.info("Building empty application map");
    NodeList nodeList = new NodeList();
    LinkList emptyLinkList = new LinkList();
    NodeType nodeType = this.nodeType;
    if (nodeType == null) {
        nodeType = NodeType.DETAILED;
    }
    Node node = new Node(nodeType, application);
    if (serverInstanceListFactory != null) {
        ServerInstanceList runningInstances = serverInstanceListFactory.createWasNodeInstanceList(node, range.getTo());
        if (runningInstances.getInstanceCount() > 0) {
            node.setServerInstanceList(runningInstances);
            nodeList.addNode(node);
        }
    }
    NodeHistogramFactory nodeHistogramFactory = this.nodeHistogramFactory;
    if (nodeHistogramFactory == null) {
        nodeHistogramFactory = new EmptyNodeHistogramFactory();
    }
    NodeHistogramAppender nodeHistogramAppender = nodeHistogramAppenderFactory.create(nodeHistogramFactory);
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, emptyLinkList, timeoutMillis);
    return new DefaultApplicationMap(range, nodeList, emptyLinkList);
}
Also used : NodeHistogramAppender(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramAppender) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) NodeType(com.navercorp.pinpoint.web.applicationmap.nodes.NodeType) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) EmptyNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) EmptyNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory) NodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)

Example 4 with NodeList

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.

the class ApplicationMapBuilder method build.

public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, long timeoutMillis) {
    Objects.requireNonNull(linkDataDuplexMap, "linkDataDuplexMap");
    logger.info("Building application map");
    NodeType nodeType = this.nodeType;
    if (nodeType == null) {
        nodeType = NodeType.DETAILED;
    }
    LinkType linkType = this.linkType;
    if (linkType == null) {
        linkType = LinkType.DETAILED;
    }
    NodeList nodeList = NodeListFactory.createNodeList(nodeType, linkDataDuplexMap);
    LinkList linkList = LinkListFactory.createLinkList(linkType, nodeList, linkDataDuplexMap, range);
    NodeHistogramFactory nodeHistogramFactory = this.nodeHistogramFactory;
    if (nodeHistogramFactory == null) {
        nodeHistogramFactory = new EmptyNodeHistogramFactory();
    }
    NodeHistogramAppender nodeHistogramAppender = nodeHistogramAppenderFactory.create(nodeHistogramFactory);
    final TimeoutWatcher timeoutWatcher = new TimeoutWatcher(timeoutMillis);
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, timeoutWatcher.remainingTimeMillis());
    ServerInstanceListFactory serverInstanceListFactory = this.serverInstanceListFactory;
    if (serverInstanceListFactory == null) {
        serverInstanceListFactory = new EmptyServerInstanceListFactory();
    }
    ServerInfoAppender serverInfoAppender = serverInfoAppenderFactory.create(serverInstanceListFactory);
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutWatcher.remainingTimeMillis());
    MetricInfoAppender metricInfoAppender = metricInfoAppenderFactory.create();
    metricInfoAppender.appendMetricInfo(range, nodeList, linkDataDuplexMap);
    return new DefaultApplicationMap(range, nodeList, linkList);
}
Also used : ServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory) EmptyServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.EmptyServerInstanceListFactory) NodeHistogramAppender(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramAppender) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) EmptyServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.EmptyServerInstanceListFactory) EmptyNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory) NodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory) NodeType(com.navercorp.pinpoint.web.applicationmap.nodes.NodeType) EmptyNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory) LinkType(com.navercorp.pinpoint.web.applicationmap.link.LinkType) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) ServerInfoAppender(com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInfoAppender) MetricInfoAppender(com.navercorp.pinpoint.web.applicationmap.appender.metric.MetricInfoAppender)

Example 5 with NodeList

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeList in project pinpoint by naver.

the class ServerInfoAppenderTest method emptyNodeList.

@Test
public void emptyNodeList() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertTrue(nodeList.getNodeList().isEmpty());
    verifyZeroInteractions(serverInstanceListDataSource);
    verifyZeroInteractions(linkDataDuplexMap);
}
Also used : NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Range(com.navercorp.pinpoint.web.vo.Range) Test(org.junit.Test)

Aggregations

NodeList (com.navercorp.pinpoint.web.applicationmap.nodes.NodeList)19 Test (org.junit.Test)15 Range (com.navercorp.pinpoint.web.vo.Range)14 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)13 LinkList (com.navercorp.pinpoint.web.applicationmap.link.LinkList)11 LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)10 Application (com.navercorp.pinpoint.web.vo.Application)7 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)6 Link (com.navercorp.pinpoint.web.applicationmap.link.Link)5 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)4 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)4 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)4 ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)4 NodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)3 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)3 EmptyNodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory)2 NodeHistogramAppender (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramAppender)2 ServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory)2 NodeType (com.navercorp.pinpoint.web.applicationmap.nodes.NodeType)2 LinkSelector (com.navercorp.pinpoint.web.service.map.LinkSelector)2