use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class DFSLinkSelector method getLinkKey.
private LinkKey getLinkKey(LinkData emulationLinkData) {
Application fromApplication = emulationLinkData.getFromApplication();
Application toApplication = emulationLinkData.getToApplication();
return new LinkKey(fromApplication, toApplication);
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class DFSLinkSelector method fillEmulationLink.
private void fillEmulationLink(LinkDataDuplexMap linkDataDuplexMap) {
// TODO need to be reimplemented - virtual node creation logic needs an overhaul.
// Currently, only the reversed relationship node is displayed. We need to create a virtual node and convert the rpc data appropriately.
logger.debug("this.emulationLinkMarker:{}", this.emulationLinkMarker);
List<LinkData> emulationLinkDataList = findEmulationLinkData(linkDataDuplexMap);
for (LinkData emulationLinkData : emulationLinkDataList) {
LinkCallDataMap beforeImage = emulationLinkData.getLinkCallDataMap();
logger.debug("beforeImage:{}", beforeImage);
emulationLinkData.resetLinkData();
LinkKey findLinkKey = new LinkKey(emulationLinkData.getFromApplication(), emulationLinkData.getToApplication());
LinkData targetLinkData = linkDataDuplexMap.getTargetLinkData(findLinkKey);
if (targetLinkData == null) {
// There has been a case where targetLinkData was null, but exact event could not be captured for analysis.
// Logging the case for further analysis should it happen again in the future.
logger.error("targetLinkData not found findLinkKey:{}", findLinkKey);
continue;
}
// create reversed link data - convert data accepted by the target to target's call data
LinkCallDataMap targetList = targetLinkData.getLinkCallDataMap();
Collection<LinkCallData> beforeLinkDataList = beforeImage.getLinkDataList();
LinkCallData beforeLinkCallData = beforeLinkDataList.iterator().next();
for (LinkCallData agentHistogram : targetList.getLinkDataList()) {
Collection<TimeHistogram> timeHistogramList = agentHistogram.getTimeHistogram();
LinkCallDataMap linkCallDataMap = emulationLinkData.getLinkCallDataMap();
if (logger.isDebugEnabled()) {
logger.debug("emulationLink BEFORE:{}", beforeLinkCallData);
logger.debug("emulationLink agent:{}", agentHistogram);
logger.debug("emulationLink link:{}/{} -> {}/{}", agentHistogram.getTarget(), agentHistogram.getTargetServiceType(), beforeLinkCallData.getTarget(), beforeLinkCallData.getTargetServiceType().getCode());
}
linkCallDataMap.addCallData(agentHistogram.getTarget(), agentHistogram.getTargetServiceType(), beforeLinkCallData.getTarget(), beforeLinkCallData.getTargetServiceType(), timeHistogramList);
}
}
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class BFSLinkSelector method getLinkKey.
private LinkKey getLinkKey(LinkData emulationLinkData) {
Application fromApplication = emulationLinkData.getFromApplication();
Application toApplication = emulationLinkData.getToApplication();
return new LinkKey(fromApplication, toApplication);
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class BFSLinkSelector method fillEmulationLink.
private void fillEmulationLink(LinkDataDuplexMap linkDataDuplexMap, Range range) {
// TODO need to be reimplemented - virtual node creation logic needs an overhaul.
// Currently, only the reversed relationship node is displayed. We need to create a virtual node and convert the rpc data appropriately.
logger.debug("this.emulationLinkMarker:{}", this.emulationLinkMarker);
List<LinkData> emulationLinkDataList = findEmulationLinkData(linkDataDuplexMap);
for (LinkData emulationLinkData : emulationLinkDataList) {
LinkCallDataMap beforeImage = emulationLinkData.getLinkCallDataMap();
logger.debug("beforeImage:{}", beforeImage);
emulationLinkData.resetLinkData();
LinkKey findLinkKey = new LinkKey(emulationLinkData.getFromApplication(), emulationLinkData.getToApplication());
LinkData targetLinkData = linkDataDuplexMap.getTargetLinkData(findLinkKey);
if (targetLinkData == null) {
// This is a case where the emulation target node has been only "partially" visited, (ie. does not have a target link data)
// Most likely due to the limit imposed by inbound search depth.
// Must go fetch the target link data here.
final Application targetApplication = emulationLinkData.getToApplication();
final LinkDataMap callee = mapStatisticsCalleeDao.selectCallee(targetApplication, range);
targetLinkData = callee.getLinkData(findLinkKey);
if (targetLinkData == null) {
// There has been a case where targetLinkData was null, but exact event could not be captured for analysis.
// Logging the case for further analysis should it happen again in the future.
logger.error("targetLinkData not found findLinkKey:{}", findLinkKey);
continue;
}
}
// create reversed link data - convert data accepted by the target to target's call data
LinkCallDataMap targetList = targetLinkData.getLinkCallDataMap();
Collection<LinkCallData> beforeLinkDataList = beforeImage.getLinkDataList();
LinkCallData beforeLinkCallData = beforeLinkDataList.iterator().next();
for (LinkCallData agentHistogram : targetList.getLinkDataList()) {
Collection<TimeHistogram> timeHistogramList = agentHistogram.getTimeHistogram();
LinkCallDataMap linkCallDataMap = emulationLinkData.getLinkCallDataMap();
if (logger.isDebugEnabled()) {
logger.debug("emulationLink BEFORE:{}", beforeLinkCallData);
logger.debug("emulationLink agent:{}", agentHistogram);
logger.debug("emulationLink link:{}/{} -> {}/{}", agentHistogram.getTarget(), agentHistogram.getTargetServiceType(), beforeLinkCallData.getTarget(), beforeLinkCallData.getTargetServiceType().getCode());
}
linkCallDataMap.addCallData(agentHistogram.getTarget(), agentHistogram.getTargetServiceType(), beforeLinkCallData.getTarget(), beforeLinkCallData.getTargetServiceType(), timeHistogramList);
}
}
}
use of com.navercorp.pinpoint.web.vo.LinkKey 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);
}
Aggregations