Search in sources :

Example 11 with NodeList

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

the class ServerInfoAppenderTest method nullNodeList.

@Test
public void nullNodeList() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = null;
    LinkDataDuplexMap linkDataDuplexMap = mock(LinkDataDuplexMap.class);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertNull(nodeList);
    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)

Example 12 with NodeList

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

the class ServerInfoAppenderTest method terminalNode.

@Test
public void terminalNode() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
    ServiceType terminalType = ServiceTypeFactory.of(2000, "TERMINAL", TERMINAL, INCLUDE_DESTINATION_ID);
    Application terminalApplication = new Application("Terminal", terminalType);
    Node terminalNode = new Node(terminalApplication);
    nodeList.addNode(terminalNode);
    Application fromApplication = new Application("FromWas", ServiceType.TEST_STAND_ALONE);
    LinkData linkData = new LinkData(fromApplication, terminalApplication);
    linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
    linkDataDuplexMap.addSourceLinkData(linkData);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertEquals(1, terminalNode.getServerInstanceList().getInstanceCount());
}
Also used : LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) 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 13 with NodeList

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

the class ServerInfoAppenderTest method terminalNode_multipleInstances.

@Test
public void terminalNode_multipleInstances() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
    ServiceType terminalType = ServiceTypeFactory.of(2000, "TERMINAL", TERMINAL, INCLUDE_DESTINATION_ID);
    Application terminalApplication = new Application("Terminal", terminalType);
    Node terminalNode = new Node(terminalApplication);
    nodeList.addNode(terminalNode);
    Application fromApplication = new Application("FromWas", ServiceType.TEST_STAND_ALONE);
    LinkData linkData = new LinkData(fromApplication, terminalApplication);
    linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress1", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
    linkData.addLinkData("wasAgent", ServiceType.TEST_STAND_ALONE, "terminalNodeAddress2", terminalType, System.currentTimeMillis(), terminalType.getHistogramSchema().getNormalSlot().getSlotTime(), 1);
    linkDataDuplexMap.addSourceLinkData(linkData);
    // When
    serverInfoAppender.appendServerInfo(range, nodeList, linkDataDuplexMap, timeoutMillis);
    // Then
    Assert.assertEquals(2, terminalNode.getServerInstanceList().getInstanceCount());
}
Also used : LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) 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 14 with NodeList

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

the class NodeHistogramAppenderTest method emptyNodeList.

@Test
public void emptyNodeList() {
    // Given
    Range range = Range.newRange(0, 60 * 1000);
    NodeList nodeList = new NodeList();
    LinkList linkList = new LinkList();
    // When
    nodeHistogramAppender.appendNodeHistogram(range, nodeList, linkList, buildTimeoutMillis);
    // Then
    Assert.assertTrue(nodeList.getNodeList().isEmpty());
    verifyZeroInteractions(wasNodeHistogramDataSource);
}
Also used : NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) Range(com.navercorp.pinpoint.web.vo.Range) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Test(org.junit.Test)

Example 15 with NodeList

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

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