Search in sources :

Example 11 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class BFSLinkSelector method createVirtualLinkData.

private List<LinkData> createVirtualLinkData(LinkData linkData, Application toApplication, Set<AcceptApplication> acceptApplicationList) {
    logger.warn("one to N replaced. node:{}->host:{} accept:{}", linkData.getFromApplication(), toApplication.getName(), acceptApplicationList);
    List<LinkData> emulationLink = new ArrayList<>();
    for (AcceptApplication acceptApplication : acceptApplicationList) {
        // linkCallData needs to be modified - remove callHistogram on purpose
        final LinkData acceptedLinkData = new LinkData(linkData.getFromApplication(), acceptApplication.getApplication());
        acceptedLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
        emulationLink.add(acceptedLinkData);
        traceEmulationLink(acceptedLinkData);
    }
    return emulationLink;
}
Also used : AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 12 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class DFSLinkSelector method createVirtualLinkData.

private List<LinkData> createVirtualLinkData(LinkData linkData, Application toApplication, Set<AcceptApplication> acceptApplicationList) {
    logger.warn("ono to N replaced. node:{}->host:{} accept:{}", linkData.getFromApplication(), toApplication.getName(), acceptApplicationList);
    List<LinkData> emulationLink = new ArrayList<>();
    for (AcceptApplication acceptApplication : acceptApplicationList) {
        // linkCallData needs to be modified - remove callHistogram on purpose
        final LinkData acceptedLinkData = new LinkData(linkData.getFromApplication(), acceptApplication.getApplication());
        acceptedLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
        emulationLink.add(acceptedLinkData);
        traceEmulationLink(acceptedLinkData);
    }
    return emulationLink;
}
Also used : AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 13 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class BFSLinkSelectorTest method testCallee_3tier.

@Test
public void testCallee_3tier() throws Exception {
    // APP_A -> APP_B -> APP_C
    when(calleeDao.selectCallee(any(Application.class), any(Range.class))).thenReturn(newEmptyLinkDataMap());
    int callCount_A_B = 30;
    LinkDataMap linkDataMap_A_B = new LinkDataMap();
    linkDataMap_A_B.addLinkData(APP_A, "agentA", APP_B, "agentB", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_A_B);
    when(calleeDao.selectCallee(eq(APP_B), any(Range.class))).thenReturn(linkDataMap_A_B);
    int callCount_B_C = 40;
    LinkDataMap linkDataMap_B_C = new LinkDataMap();
    linkDataMap_B_C.addLinkData(APP_B, "agentB", APP_C, "agentC", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_B_C);
    when(calleeDao.selectCallee(eq(APP_C), any(Range.class))).thenReturn(linkDataMap_B_C);
    when(callerDao.selectCaller(any(Application.class), any(Range.class))).thenReturn(newEmptyLinkDataMap());
    when(hostApplicationMapDao.findAcceptApplicationName(any(Application.class), any(Range.class))).thenReturn(new HashSet<AcceptApplication>());
    LinkSelector linkSelector = createLinkSelector();
    LinkDataDuplexMap linkData = linkSelector.select(APP_C, range, oneDepth);
    Assert.assertEquals(linkData.size(), 1);
    Assert.assertEquals(linkData.getTotalCount(), callCount_B_C);
    Assert.assertEquals(linkData.getSourceLinkDataList().size(), 0);
    Assert.assertEquals(linkData.getTargetLinkDataList().size(), 1);
    Assert.assertEquals(linkData.getTotalCount(), callCount_B_C);
    // depth 2
    LinkSelector linkSelector2 = createLinkSelector();
    LinkDataDuplexMap linkData_depth2 = linkSelector2.select(APP_C, range, twoDepth);
    Assert.assertEquals(linkData_depth2.size(), 2);
    LinkKey linkKey_A_B = new LinkKey(APP_A, APP_B);
    assertTarget_Source_TotalCount("APP_A->APP_B", linkData_depth2, linkKey_A_B, callCount_A_B);
    LinkKey linkKey_B_C = new LinkKey(APP_B, APP_C);
    assertTarget_Source_TotalCount("APP_B->APP_C", linkData_depth2, linkKey_B_C, callCount_B_C);
}
Also used : LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) Range(com.navercorp.pinpoint.web.vo.Range) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Test(org.junit.Test)

Example 14 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class BFSLinkSelectorTest method testCaller_3tier.

@Test
public void testCaller_3tier() throws Exception {
    // APP_A -> APP_B -> APP_C
    int callCount_A_B = 10;
    LinkDataMap link_A_B = new LinkDataMap();
    link_A_B.addLinkData(APP_A, "agentA", APP_B, "agentB", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_A_B);
    when(callerDao.selectCaller(eq(APP_A), any(Range.class))).thenReturn(link_A_B);
    LinkDataMap link_B_C = new LinkDataMap();
    int callCount_B_C = 20;
    link_B_C.addLinkData(APP_B, "agentB", APP_C, "agentC", 1000, BaseHistogramSchema.NORMAL_SCHEMA.getNormalSlot().getSlotTime(), callCount_B_C);
    when(callerDao.selectCaller(eq(APP_B), any(Range.class))).thenReturn(link_B_C);
    when(calleeDao.selectCallee(any(Application.class), any(Range.class))).thenReturn(newEmptyLinkDataMap());
    when(hostApplicationMapDao.findAcceptApplicationName(any(Application.class), any(Range.class))).thenReturn(new HashSet<AcceptApplication>());
    // depth 1
    LinkSelector linkSelector = createLinkSelector();
    LinkDataDuplexMap linkData = linkSelector.select(APP_A, range, oneDepth);
    Assert.assertEquals(linkData.size(), 1);
    Assert.assertEquals(linkData.getTotalCount(), callCount_A_B);
    Assert.assertEquals(linkData.getSourceLinkDataList().size(), 1);
    Assert.assertEquals(linkData.getSourceLinkDataMap().getTotalCount(), callCount_A_B);
    assertSource_Target_TotalCount("APP_A->APP_B", linkData, new LinkKey(APP_A, APP_B), callCount_A_B);
    Assert.assertEquals(linkData.getTargetLinkDataList().size(), 0);
    // depth 2
    LinkSelector linkSelector2 = createLinkSelector();
    LinkDataDuplexMap linkData_depth2 = linkSelector2.select(APP_A, range, twoDepth);
    Assert.assertEquals(linkData_depth2.size(), 2);
    Assert.assertEquals(linkData_depth2.getTotalCount(), callCount_A_B + callCount_B_C);
    LinkKey linkKey_A_B = new LinkKey(APP_A, APP_B);
    assertSource_Target_TotalCount("APP_A->APP_B", linkData_depth2, linkKey_A_B, callCount_A_B);
    LinkKey linkKey_B_C = new LinkKey(APP_B, APP_C);
    assertSource_Target_TotalCount("APP_B->APP_C", linkData_depth2, linkKey_B_C, callCount_B_C);
}
Also used : LinkKey(com.navercorp.pinpoint.web.vo.LinkKey) Range(com.navercorp.pinpoint.web.vo.Range) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Test(org.junit.Test)

Example 15 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class AcceptApplicationLocalCache method put.

public void put(RpcApplication findKey, Set<AcceptApplication> acceptApplicationSet) {
    if (CollectionUtils.isEmpty(acceptApplicationSet)) {
        // initialize for empty value
        this.acceptApplicationLocalCache.putIfAbsent(findKey, Sets.newConcurrentHashSet());
        return;
    }
    logger.debug("findAcceptApplication:{}", acceptApplicationSet);
    // set AcceptApplication for each url
    for (AcceptApplication acceptApplication : acceptApplicationSet) {
        // acceptApplicationSet data contains the url and the accept node's applicationName.
        // we need to recreate the key set based on the url and the calling application.
        RpcApplication newKey = new RpcApplication(acceptApplication.getHost(), findKey.getApplication());
        Set<AcceptApplication> findSet = this.acceptApplicationLocalCache.get(newKey);
        if (findSet == null) {
            Set<AcceptApplication> set = Sets.newConcurrentHashSet();
            findSet = this.acceptApplicationLocalCache.putIfAbsent(newKey, set);
            if (findSet == null) {
                findSet = set;
            }
        }
        findSet.add(acceptApplication);
    }
}
Also used : AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Aggregations

AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)18 Application (com.navercorp.pinpoint.web.vo.Application)11 Test (org.junit.Test)6 LinkKey (com.navercorp.pinpoint.web.vo.LinkKey)5 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)4 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)4 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)3 VirtualLinkMarker (com.navercorp.pinpoint.web.service.map.VirtualLinkMarker)3 Range (com.navercorp.pinpoint.web.vo.Range)2 HashSet (java.util.HashSet)2 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cell (org.apache.hadoop.hbase.Cell)1 TableName (org.apache.hadoop.hbase.TableName)1 Scan (org.apache.hadoop.hbase.client.Scan)1