use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.
the class LinkListTest method testSize.
@Test
public void testSize() {
LinkList list = new LinkList();
Assert.assertEquals(list.size(), 0);
list.addLink(createTomcatToTomcatLink());
Assert.assertEquals(list.size(), 1);
}
use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.
the class LinkListTest method testContainsNode.
@Test
public void testContainsNode() {
Link tomcatToBlocLink = createTomcatToBlocLink();
LinkList list = new LinkList();
Assert.assertFalse(list.containsNode(tomcatToBlocLink));
list.addLink(tomcatToBlocLink);
Assert.assertTrue(list.containsNode(tomcatToBlocLink));
}
use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.
the class DefaultApplicationMap method createNewLinkList.
private LinkList createNewLinkList(LinkList originalLinkList) {
Collection<Link> linkList = originalLinkList.getLinkList();
if (CollectionUtils.nullSafeSize(linkList) == 0) {
return originalLinkList;
}
LinkList newLinkList = new LinkList();
for (Link link : linkList) {
if (link == null) {
continue;
}
if (link.getHistogram().getTotalCount() == 0) {
continue;
}
newLinkList.addLink(link);
}
return newLinkList;
}
use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.
the class ResponseTimeHistogramServiceImpl method selectLinkHistogramData.
@Override
public LinkHistogramSummary selectLinkHistogramData(Application fromApplication, Application toApplication, Range range) {
Objects.requireNonNull(fromApplication, "fromApplication");
Objects.requireNonNull(toApplication, "toApplication");
Objects.requireNonNull(range, "range");
LinkDataDuplexMap linkDataDuplexMap;
ServiceType fromApplicationServiceType = fromApplication.getServiceType();
CreateType createType = CreateType.Target;
// For user or queue originating links, we must scan using to applications
if (fromApplicationServiceType.isUser() || fromApplicationServiceType.isQueue()) {
createType = CreateType.Source;
LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(fromApplication);
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
linkDataDuplexMap = linkSelector.select(Collections.singletonList(toApplication), range, 0, 1);
} else {
LinkDataMapProcessor destinationApplication = new DestinationApplicationFilter(toApplication);
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplication, LinkDataMapProcessor.NO_OP);
linkDataDuplexMap = linkSelector.select(Collections.singletonList(fromApplication), range, 1, 0);
}
NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, range);
LinkKey linkKey = new LinkKey(fromApplication, toApplication);
Link link = linkList.getLink(linkKey);
if (link == null) {
return createEmptyLinkHistogramSummary(createType, fromApplication, toApplication, range);
}
return new LinkHistogramSummary(link);
}
use of com.navercorp.pinpoint.web.applicationmap.link.LinkList in project pinpoint by naver.
the class ResponseTimeHistogramServiceImpl method selectNodeHistogramData.
@Override
public NodeHistogramSummary selectNodeHistogramData(ResponseTimeHistogramServiceOption option) {
Node node = new Node(option.getApplication());
ServiceType applicationServiceType = option.getApplication().getServiceType();
List<Application> sourceApplications = option.getFromApplications();
List<Application> destinationApplications = option.getToApplications();
final NodeHistogramFactory nodeHistogramFactory = createNodeHistogramFactory();
final ServerInstanceListFactory serverInstanceListFactory = createServerInstanceListFactory(option);
if (applicationServiceType.isWas()) {
NodeHistogram nodeHistogram = nodeHistogramFactory.createWasNodeHistogram(option.getApplication(), option.getRange());
node.setNodeHistogram(nodeHistogram);
ServerInstanceList serverInstanceList = serverInstanceListFactory.createWasNodeInstanceList(node, option.getRange().getTo());
return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
} else if (applicationServiceType.isTerminal() || applicationServiceType.isUnknown() || applicationServiceType.isAlias()) {
if (sourceApplications.isEmpty()) {
return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
}
LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
ServerInstanceList serverInstanceList = serverInstanceListFactory.createEmptyNodeInstanceList();
if (applicationServiceType.isTerminal() || applicationServiceType.isAlias()) {
serverInstanceList = serverInstanceListFactory.createTerminalNodeInstanceList(node, linkDataDuplexMap);
}
NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
NodeHistogram nodeHistogram = nodeHistogramFactory.createTerminalNodeHistogram(option.getApplication(), option.getRange(), linkList);
return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
} else if (applicationServiceType.isQueue()) {
LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
if (sourceApplications.isEmpty()) {
if (destinationApplications.isEmpty()) {
return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
}
// Retrieve callers
LinkDataMapProcessor applicationFilter = new ApplicationFilter(option.getApplication());
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, applicationFilter);
LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 0, 2);
LinkDataMap linkDataMap = destinationApplicationFilter.processLinkDataMap(linkDataDuplexMap.getTargetLinkDataMap(), option.getRange());
for (LinkData linkData : linkDataMap.getLinkDataList()) {
sourceApplications.add(linkData.getFromApplication());
}
}
// Check using from applications first for caller's link data
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
ServerInstanceList serverInstanceList = serverInstanceListFactory.createQueueNodeInstanceList(node, linkDataDuplexMap);
NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
NodeHistogram nodeHistogram = nodeHistogramFactory.createQueueNodeHistogram(option.getApplication(), option.getRange(), linkList);
return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
} else if (applicationServiceType.isUser()) {
if (destinationApplications.isEmpty()) {
return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
}
LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(option.getApplication());
LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(destinationApplications, option.getRange(), 0, 1);
ServerInstanceList serverInstanceList = serverInstanceListFactory.createUserNodeInstanceList();
NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
NodeHistogram nodeHistogram = nodeHistogramFactory.createUserNodeHistogram(option.getApplication(), option.getRange(), linkList);
return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
} else {
return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
}
}
Aggregations