Search in sources :

Example 6 with ServerInstanceList

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

the class LinkSerializer method writeAgentIdNameMap.

private void writeAgentIdNameMap(String fieldName, Node node, JsonGenerator jgen) throws IOException {
    if (node.getServiceType().isWas()) {
        jgen.writeFieldName(fieldName);
        jgen.writeStartObject();
        ServerInstanceList serverInstanceList = node.getServerInstanceList();
        if (serverInstanceList != null) {
            for (Map.Entry<String, String> entry : serverInstanceList.getAgentIdNameMap().entrySet()) {
                jgen.writeStringField(entry.getKey(), entry.getValue());
            }
        }
        jgen.writeEndObject();
    }
}
Also used : ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) Map(java.util.Map)

Example 7 with ServerInstanceList

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

the class LinkSerializer method writeAgentId.

private void writeAgentId(String fieldName, Node node, JsonGenerator jgen) throws IOException {
    if (node.getServiceType().isWas()) {
        jgen.writeFieldName(fieldName);
        jgen.writeStartArray();
        ServerInstanceList serverInstanceList = node.getServerInstanceList();
        if (serverInstanceList != null) {
            for (String agentId : serverInstanceList.getAgentIdList()) {
                jgen.writeObject(agentId);
            }
        }
        jgen.writeEndArray();
    }
}
Also used : ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)

Example 8 with ServerInstanceList

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

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

the class ServerInfoAppenderTest method wasNode.

@Test
public void wasNode() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
    Node wasNode = new Node(new Application("Was", ServiceType.TEST_STAND_ALONE));
    nodeList.addNode(wasNode);
    ServerInstanceList serverInstanceList = new ServerInstanceList();
    when(serverInstanceListDataSource.createServerInstanceList(wasNode, range.getTo())).thenReturn(serverInstanceList);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertSame(serverInstanceList, wasNode.getServerInstanceList());
    verifyZeroInteractions(linkDataDuplexMap);
}
Also used : NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 10 with ServerInstanceList

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

the class ServerInfoAppenderTest method wasNodes.

@Test
public void wasNodes() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
    Node wasNode1 = new Node(new Application("Was1", ServiceType.TEST_STAND_ALONE));
    nodeList.addNode(wasNode1);
    Node wasNode2 = new Node(new Application("Was2", ServiceType.TEST_STAND_ALONE));
    nodeList.addNode(wasNode2);
    ServerInstanceList serverInstanceList1 = new ServerInstanceList();
    when(serverInstanceListDataSource.createServerInstanceList(wasNode1, range.getTo())).thenReturn(serverInstanceList1);
    ServerInstanceList serverInstanceList2 = new ServerInstanceList();
    when(serverInstanceListDataSource.createServerInstanceList(wasNode2, range.getTo())).thenReturn(serverInstanceList2);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertSame(serverInstanceList1, wasNode1.getServerInstanceList());
    Assert.assertSame(serverInstanceList2, wasNode2.getServerInstanceList());
    verifyZeroInteractions(linkDataDuplexMap);
}
Also used : NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

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