use of com.navercorp.pinpoint.web.vo.LinkKey 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);
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class LinkList method addLink.
public boolean addLink(Link link) {
if (link == null) {
throw new NullPointerException("link must not be null");
}
final LinkKey linkId = link.getLinkKey();
final Link find = this.linkMap.get(linkId);
if (find != null) {
return false;
}
return this.linkMap.put(linkId, link) == null;
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class LinkCallDataMap method getSourceList.
public AgentHistogramList getSourceList() {
AgentHistogramList sourceList = new AgentHistogramList();
for (Map.Entry<LinkKey, LinkCallData> linkKeyRawCallDataEntry : linkDataMap.entrySet()) {
final LinkKey key = linkKeyRawCallDataEntry.getKey();
final LinkCallData linkCallData = linkKeyRawCallDataEntry.getValue();
// need target (to) ServiceType
// the definition of source is data from the source when the source sends a request to a target.
// Thus ServiceType is the target's ServiceType
sourceList.addAgentHistogram(key.getFromApplication(), key.getToServiceType(), linkCallData.getTimeHistogram());
}
return sourceList;
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class LinkCallDataMap method addLinkDataMap.
public void addLinkDataMap(LinkCallDataMap target) {
if (target == null) {
throw new NullPointerException("target must not be null");
}
for (Map.Entry<LinkKey, LinkCallData> copyEntry : target.linkDataMap.entrySet()) {
final LinkKey key = copyEntry.getKey();
final LinkCallData copyLinkCallData = copyEntry.getValue();
LinkCallData linkCallData = getLinkCallData(key);
linkCallData.addRawCallData(copyLinkCallData);
}
}
use of com.navercorp.pinpoint.web.vo.LinkKey in project pinpoint by naver.
the class LinkCallDataMap method getTargetList.
public AgentHistogramList getTargetList() {
AgentHistogramList targetList = new AgentHistogramList();
for (Map.Entry<LinkKey, LinkCallData> linkKeyRawCallDataEntry : linkDataMap.entrySet()) {
final LinkKey key = linkKeyRawCallDataEntry.getKey();
final LinkCallData linkCallData = linkKeyRawCallDataEntry.getValue();
targetList.addAgentHistogram(key.getToApplication(), key.getToServiceType(), linkCallData.getTimeHistogram());
}
return targetList;
}
Aggregations