Search in sources :

Example 1 with ServerInstanceList

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

the class AgentInfoServerInstanceListDataSource method createServerInstanceList.

public ServerInstanceList createServerInstanceList(Node node, long timestamp) {
    Objects.requireNonNull(node, "node");
    if (timestamp < 0) {
        return new ServerInstanceList();
    }
    Application application = node.getApplication();
    Set<AgentInfo> agentInfos = agentInfoService.getAgentsByApplicationNameWithoutStatus(application.getName(), timestamp);
    if (CollectionUtils.isEmpty(agentInfos)) {
        logger.warn("agentInfo not found. application:{}", application);
        return new ServerInstanceList();
    }
    logger.debug("unfiltered agentInfos {}", agentInfos);
    agentInfos = filterAgentInfos(agentInfos, timestamp, node);
    logger.debug("add agentInfos {} : {}", application, agentInfos);
    ServerBuilder builder = new ServerBuilder();
    builder.addAgentInfo(agentInfos);
    return builder.build();
}
Also used : ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) Application(com.navercorp.pinpoint.web.vo.Application) ServerBuilder(com.navercorp.pinpoint.web.applicationmap.nodes.ServerBuilder)

Example 2 with ServerInstanceList

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

the class DefaultServerInfoAppender method getServerInstanceListFuture.

private CompletableFuture<Void> getServerInstanceListFuture(Range range, Node node, LinkDataDuplexMap linkDataDuplexMap, AtomicBoolean stopSign) {
    CompletableFuture<ServerInstanceList> serverInstanceListFuture;
    ServiceType nodeServiceType = node.getServiceType();
    if (nodeServiceType.isWas()) {
        final long to = range.getTo();
        serverInstanceListFuture = CompletableFuture.supplyAsync(new Supplier<ServerInstanceList>() {

            @Override
            public ServerInstanceList get() {
                if (Boolean.TRUE == stopSign.get()) {
                    // Stop
                    return serverInstanceListFactory.createEmptyNodeInstanceList();
                }
                return serverInstanceListFactory.createWasNodeInstanceList(node, to);
            }
        }, executor);
    } else if (nodeServiceType.isTerminal() || nodeServiceType.isAlias()) {
        // extract information about the terminal node
        serverInstanceListFuture = CompletableFuture.completedFuture(serverInstanceListFactory.createTerminalNodeInstanceList(node, linkDataDuplexMap));
    } else if (nodeServiceType.isQueue()) {
        serverInstanceListFuture = CompletableFuture.completedFuture(serverInstanceListFactory.createQueueNodeInstanceList(node, linkDataDuplexMap));
    } else if (nodeServiceType.isUser()) {
        serverInstanceListFuture = CompletableFuture.completedFuture(serverInstanceListFactory.createUserNodeInstanceList());
    } else {
        serverInstanceListFuture = CompletableFuture.completedFuture(serverInstanceListFactory.createEmptyNodeInstanceList());
    }
    return serverInstanceListFuture.thenAccept(node::setServerInstanceList);
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) Supplier(java.util.function.Supplier)

Example 3 with ServerInstanceList

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

the class ResponseTimeHistogramServiceImpl method createEmptyNodeHistogramSummary.

private NodeHistogramSummary createEmptyNodeHistogramSummary(ServerInstanceListFactory serverInstanceListFactory, Application application, Range range) {
    ServerInstanceList serverInstanceList = serverInstanceListFactory.createEmptyNodeInstanceList();
    NodeHistogram emptyNodeHistogram = new NodeHistogram(application, range);
    return new NodeHistogramSummary(serverInstanceList, emptyNodeHistogram);
}
Also used : NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)

Example 4 with ServerInstanceList

use of com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList 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 5 with ServerInstanceList

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

the class ServerInstanceListSerializer method serialize.

@Override
public void serialize(ServerInstanceList serverInstanceList, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    Map<String, List<ServerInstance>> map = serverInstanceList.getServerInstanceList();
    for (Map.Entry<String, List<ServerInstance>> entry : map.entrySet()) {
        jgen.writeFieldName(entry.getKey());
        jgen.writeStartObject();
        jgen.writeStringField("name", entry.getKey());
        jgen.writeStringField("status", null);
        if (matcherGroupList != null) {
            jgen.writeFieldName("linkList");
            jgen.writeStartArray();
            for (MatcherGroup matcherGroup : matcherGroupList) {
                if (matcherGroup.ismatchingType(entry.getValue().get(0))) {
                    LinkInfo linkInfo = matcherGroup.makeLinkInfo(entry.getValue().get(0));
                    jgen.writeStartObject();
                    jgen.writeStringField("linkName", linkInfo.getLinkName());
                    jgen.writeStringField("linkURL", linkInfo.getLinkUrl());
                    jgen.writeStringField("linkType", linkInfo.getLinktype());
                    jgen.writeEndObject();
                }
            }
            jgen.writeEndArray();
        }
        jgen.writeFieldName("instanceList");
        writeInstanceList(jgen, entry.getValue());
        jgen.writeEndObject();
    }
    jgen.writeEndObject();
}
Also used : MatcherGroup(com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) List(java.util.List) LinkInfo(com.navercorp.pinpoint.web.applicationmap.link.LinkInfo) Map(java.util.Map)

Aggregations

ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)15 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)4 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)4 NodeList (com.navercorp.pinpoint.web.applicationmap.nodes.NodeList)4 ServerBuilder (com.navercorp.pinpoint.web.applicationmap.nodes.ServerBuilder)4 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)4 Application (com.navercorp.pinpoint.web.vo.Application)4 Test (org.junit.Test)4 LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)2 NodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)2 LinkList (com.navercorp.pinpoint.web.applicationmap.link.LinkList)2 NodeHistogramSummary (com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary)2 Range (com.navercorp.pinpoint.web.vo.Range)2 ServerInstanceListTest (com.navercorp.pinpoint.web.applicationmap.ServerInstanceListTest)1 DefaultNodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.DefaultNodeHistogramFactory)1 EmptyNodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.EmptyNodeHistogramFactory)1 NodeHistogramAppender (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramAppender)1