Search in sources :

Example 16 with LinkList

use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.

the class NodeHistogramAppenderTest method terminalNode.

/**
 * Checks histograms for a single terminal node.
 * <pre>
 *     fromNode ---> databaseNode
 * </pre>
 */
@Test
public void terminalNode() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    // fromNode : [testApp] test-app
    Node fromNode = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
    String fromNodeAgent = "test-app";
    // toNode : [testDatabase] test-database
    Node toNode = createNode("testDatabase", ServiceTypeFactory.of(2000, "RDB", ServiceTypeProperty.TERMINAL));
    String toNodeAgent = "test-database";
    nodeList.addNode(toNode);
    Link link = new Link(CreateType.Source, fromNode, toNode, range);
    HistogramSlot fastSlot = toNode.getServiceType().getHistogramSchema().getFastSlot();
    HistogramSlot normalSlot = toNode.getServiceType().getHistogramSchema().getNormalSlot();
    HistogramSlot slowSlot = toNode.getServiceType().getHistogramSchema().getSlowSlot();
    // [testApp] test-app -> [testDatabase] test-database
    long fastCallCount = 200L;
    long normalCallCount = 100L;
    long slowCallCount = 75L;
    link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), fastSlot, fastCallCount));
    link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), normalSlot, normalCallCount));
    link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent, toNode.getServiceType(), slowSlot, slowCallCount));
    linkList.addLink(link);
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    // Then
    Node actualNode = nodeList.getNodeList().iterator().next();
    NodeHistogram nodeHistogram = actualNode.getNodeHistogram();
    // verify application-level histogram
    Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
    Assert.assertEquals(fastCallCount, applicationHistogram.getFastCount());
    Assert.assertEquals(normalCallCount, applicationHistogram.getNormalCount());
    Assert.assertEquals(slowCallCount, applicationHistogram.getSlowCount());
    Assert.assertEquals(fastCallCount + normalCallCount + slowCallCount, applicationHistogram.getTotalCount());
    // verify agent-level histogram
    Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
    Histogram agentHistogram = agentHistogramMap.get(toNodeAgent);
    Assert.assertEquals(fastCallCount, agentHistogram.getFastCount());
    Assert.assertEquals(normalCallCount, agentHistogram.getNormalCount());
    Assert.assertEquals(slowCallCount, agentHistogram.getSlowCount());
    Assert.assertEquals(fastCallCount + normalCallCount + slowCallCount, agentHistogram.getTotalCount());
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) Test(org.junit.Test)

Example 17 with LinkList

use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.

the class NodeHistogramAppenderTest method wasNode.

/**
 * Checks histograms for was node.
 */
@Test
public void wasNode() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    Node node = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
    nodeList.addNode(node);
    NodeHistogram nodeHistogram = new NodeHistogram(node.getApplication(), range);
    when(wasNodeHistogramDataSource.createNodeHistogram(node.getApplication(), range)).thenReturn(nodeHistogram);
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    // Then
    Node actualNode = nodeList.getNodeList().iterator().next();
    Assert.assertSame(nodeHistogram, actualNode.getNodeHistogram());
}
Also used : NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Test(org.junit.Test)

Example 18 with LinkList

use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.

the class NodeHistogramAppenderTest method terminalNodes.

/**
 * Checks histograms for multiple terminal nodes called from a single node.
 * <pre>
 *     fromNode ---> databaseNode
 *               |-> cacheNode
 * </pre>
 */
@Test
public void terminalNodes() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    // fromNode : [testApp] test-app
    Node fromNode = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
    String fromNodeAgent = "test-app";
    // databaseNode : [testDatabase] test-database
    Node databaseNode = createNode("testDatabase", ServiceTypeFactory.of(2000, "RDB", ServiceTypeProperty.TERMINAL));
    String databaseNodeAgent = "test-database";
    nodeList.addNode(databaseNode);
    // cacheNode : [testCache] test-cache
    Node cacheNode = createNode("testCache", ServiceTypeFactory.of(8000, "Cache", ServiceTypeProperty.TERMINAL));
    String cacheNodeAgent = "test-cache";
    nodeList.addNode(cacheNode);
    Link databaseLink = new Link(CreateType.Source, fromNode, databaseNode, range);
    HistogramSlot databaseSlowSlot = databaseNode.getServiceType().getHistogramSchema().getSlowSlot();
    long databaseCallSlowCount = 50L;
    databaseLink.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), databaseNodeAgent, databaseNode.getServiceType(), databaseSlowSlot, databaseCallSlowCount));
    linkList.addLink(databaseLink);
    Link cacheLink = new Link(CreateType.Source, fromNode, cacheNode, range);
    HistogramSlot cacheFastSlot = cacheNode.getServiceType().getHistogramSchema().getFastSlot();
    HistogramSlot cacheSlowSlot = cacheNode.getServiceType().getHistogramSchema().getSlowSlot();
    long cacheCallFastCount = 199L;
    long cacheCallSlowCount = 99L;
    cacheLink.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), cacheNodeAgent, cacheNode.getServiceType(), cacheFastSlot, cacheCallFastCount));
    cacheLink.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), cacheNodeAgent, cacheNode.getServiceType(), cacheSlowSlot, cacheCallSlowCount));
    linkList.addLink(cacheLink);
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    // Then
    // Database node
    Node actualDatabaseNode = nodeList.findNode(databaseNode.getApplication());
    NodeHistogram databaseNodeHistogram = actualDatabaseNode.getNodeHistogram();
    // verify application-level histogram
    Histogram databaseApplicationHistogram = databaseNodeHistogram.getApplicationHistogram();
    Assert.assertEquals(databaseCallSlowCount, databaseApplicationHistogram.getSlowCount());
    Assert.assertEquals(databaseCallSlowCount, databaseApplicationHistogram.getTotalCount());
    // verify agent-level histogram
    Map<String, Histogram> databaseAgentHistogramMap = databaseNodeHistogram.getAgentHistogramMap();
    Histogram databaseAgentHistogram = databaseAgentHistogramMap.get(databaseNodeAgent);
    Assert.assertEquals(databaseCallSlowCount, databaseAgentHistogram.getSlowCount());
    Assert.assertEquals(databaseCallSlowCount, databaseAgentHistogram.getTotalCount());
    // Cache node
    Node actualCacheNode = nodeList.findNode(cacheNode.getApplication());
    NodeHistogram cacheNodeHistogram = actualCacheNode.getNodeHistogram();
    // verify application-level histogram
    Histogram cacheApplicationHistogram = cacheNodeHistogram.getApplicationHistogram();
    Assert.assertEquals(cacheCallFastCount, cacheApplicationHistogram.getFastCount());
    Assert.assertEquals(cacheCallSlowCount, cacheApplicationHistogram.getSlowCount());
    Assert.assertEquals(cacheCallFastCount + cacheCallSlowCount, cacheApplicationHistogram.getTotalCount());
    // verify agent-level histogram
    Map<String, Histogram> cacheAgentHistogramMap = cacheNodeHistogram.getAgentHistogramMap();
    Histogram cacheAgentHistogram = cacheAgentHistogramMap.get(cacheNodeAgent);
    Assert.assertEquals(cacheCallFastCount, cacheAgentHistogram.getFastCount());
    Assert.assertEquals(cacheCallSlowCount, cacheAgentHistogram.getSlowCount());
    Assert.assertEquals(cacheCallFastCount + cacheCallSlowCount, cacheAgentHistogram.getTotalCount());
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) Test(org.junit.Test)

Example 19 with LinkList

use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.

the class NodeHistogramAppenderTest method userNode.

/**
 * Checks histograms for user node.
 * <pre>
 *     userNode ---> wasNode (2 agents)
 * </pre>
 */
@Test
public void userNode() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    // userNode : [userNode] user
    Node userNode = createNode("userNode", ServiceType.USER);
    String userNodeAgent = "user";
    nodeList.addNode(userNode);
    // wasNode : [wasNode] was-1, was-2
    Node wasNode = createNode("wasNode", ServiceTypeFactory.of(1000, "WAS"));
    String wasNodeAgent1 = "was-1";
    String wasNodeAgent2 = "was-2";
    nodeList.addNode(wasNode);
    Link link = new Link(CreateType.Target, userNode, wasNode, range);
    HistogramSlot fastSlot = wasNode.getServiceType().getHistogramSchema().getFastSlot();
    HistogramSlot normalSlot = wasNode.getServiceType().getHistogramSchema().getNormalSlot();
    // [userNode] user -> [wasNode] was-1
    long fastCallCount = 100L;
    link.addTarget(createLinkCallDataMap(userNodeAgent, userNode.getServiceType(), wasNodeAgent1, wasNode.getServiceType(), fastSlot, fastCallCount));
    // [userNode] user -> [wasNode] was-2
    long normalCallCount = 50L;
    link.addTarget(createLinkCallDataMap(userNodeAgent, userNode.getServiceType(), wasNodeAgent2, wasNode.getServiceType(), normalSlot, normalCallCount));
    linkList.addLink(link);
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    NodeHistogram nodeHistogram = userNode.getNodeHistogram();
    // verify application-level histogram
    Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
    Assert.assertEquals(fastCallCount, applicationHistogram.getFastCount());
    Assert.assertEquals(normalCallCount, applicationHistogram.getNormalCount());
    Assert.assertEquals(fastCallCount + normalCallCount, applicationHistogram.getTotalCount());
    // verify agent-level histogram - there is none for user node
    Map<String, Histogram> databaseAgentHistogramMap = nodeHistogram.getAgentHistogramMap();
    Assert.assertTrue(databaseAgentHistogramMap.isEmpty());
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) Test(org.junit.Test)

Example 20 with LinkList

use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.

the class NodeHistogramAppenderTest method terminalNode_multiple.

/**
 * Checks histograms for a single terminal node with multiple agents(destinations).
 * <pre>
 *     fromNode ---> databaseNode (2 agents)
 * </pre>
 */
@Test
public void terminalNode_multiple() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    // fromNode : [testApp] test-app
    Node fromNode = createNode("testApp", ServiceTypeFactory.of(1000, "WAS"));
    String fromNodeAgent = "test-app";
    // toNode : [testDatabase] test-database1, test-database2
    Node toNode = createNode("testDatabase", ServiceTypeFactory.of(2000, "RDB", ServiceTypeProperty.TERMINAL));
    String toNodeAgent1 = "test-database1";
    String toNodeAgent2 = "test-database2";
    nodeList.addNode(toNode);
    Link link = new Link(CreateType.Source, fromNode, toNode, range);
    HistogramSlot fastSlot = toNode.getServiceType().getHistogramSchema().getFastSlot();
    HistogramSlot normalSlot = toNode.getServiceType().getHistogramSchema().getNormalSlot();
    // [testApp] test-app -> [testDatabase] test-database1
    long callCount1 = 100L;
    link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent1, toNode.getServiceType(), fastSlot, callCount1));
    // [testApp] test-app -> [testDatabase] test-database2
    long callCount2 = 50L;
    link.addSource(createLinkCallDataMap(fromNodeAgent, fromNode.getServiceType(), toNodeAgent2, toNode.getServiceType(), normalSlot, callCount2));
    linkList.addLink(link);
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    // Then
    Node actualNode = nodeList.getNodeList().iterator().next();
    NodeHistogram nodeHistogram = actualNode.getNodeHistogram();
    // verify application-level histogram
    Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
    Assert.assertEquals(callCount1, applicationHistogram.getFastCount());
    Assert.assertEquals(callCount2, applicationHistogram.getNormalCount());
    Assert.assertEquals(callCount1 + callCount2, applicationHistogram.getTotalCount());
    // verify agent-level histogram
    Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
    Histogram agent1Histogram = agentHistogramMap.get(toNodeAgent1);
    Assert.assertEquals(callCount1, agent1Histogram.getFastCount());
    Assert.assertEquals(callCount1, agent1Histogram.getTotalCount());
    Histogram agent2Histogram = agentHistogramMap.get(toNodeAgent2);
    Assert.assertEquals(callCount2, agent2Histogram.getNormalCount());
    Assert.assertEquals(callCount2, agent2Histogram.getTotalCount());
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) Test(org.junit.Test)

Aggregations

LinkList (com.navercorp.pinpoint.web.applicationmap.link.LinkList)20 Test (org.junit.Test)13 Link (com.navercorp.pinpoint.web.applicationmap.link.Link)12 NodeList (com.navercorp.pinpoint.web.applicationmap.nodes.NodeList)11 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)9 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)6 Range (com.navercorp.pinpoint.web.vo.Range)6 Application (com.navercorp.pinpoint.web.vo.Application)5 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)4 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)4 NodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)2 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 ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)2 LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)2 LinkSelector (com.navercorp.pinpoint.web.service.map.LinkSelector)2 DestinationApplicationFilter (com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter)2