use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.
the class BFSLinkSelector method checkRpcCallAccepted.
private List<LinkData> checkRpcCallAccepted(LinkData linkData, Range range) {
// replace if the rpc client's destination has an agent installed and thus has an application name
final Application toApplication = linkData.getToApplication();
if (!toApplication.getServiceType().isRpcClient() && !toApplication.getServiceType().isQueue()) {
return Collections.singletonList(linkData);
}
logger.debug("checkRpcCallAccepted(). Find applicationName:{} {}", toApplication, range);
final Set<AcceptApplication> acceptApplicationList = findAcceptApplication(linkData.getFromApplication(), toApplication.getName(), range);
logger.debug("find accept application:{}", acceptApplicationList);
if (CollectionUtils.isNotEmpty(acceptApplicationList)) {
if (acceptApplicationList.size() == 1) {
logger.debug("Application info replaced. {} => {}", linkData, acceptApplicationList);
AcceptApplication first = acceptApplicationList.iterator().next();
final LinkData acceptedLinkData = new LinkData(linkData.getFromApplication(), first.getApplication());
acceptedLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
return Collections.singletonList(acceptedLinkData);
} else {
// special case - there are more than 2 nodes grouped by a single url
return createVirtualLinkData(linkData, toApplication, acceptApplicationList);
}
} else {
// for queues, accept application may not exist if no consumers have an agent installed
if (toApplication.getServiceType().isQueue()) {
return Collections.singletonList(linkData);
} else {
final Application unknown = new Application(toApplication.getName(), ServiceType.UNKNOWN);
final LinkData unknownLinkData = new LinkData(linkData.getFromApplication(), unknown);
unknownLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
return Collections.singletonList(unknownLinkData);
}
}
}
use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.
the class DFSLinkSelector method selectCallee.
/**
* Queries for all applications(caller) that called calleeApplication
*
* @param calleeApplication
* @param range
* @return
*/
private LinkDataDuplexMap selectCallee(Application calleeApplication, Range range, SearchDepth searchDepth) {
// skip if the calleeApplication has already been checked
if (linkVisitChecker.visitCallee(calleeApplication)) {
return new LinkDataDuplexMap();
}
final LinkDataMap callee = mapStatisticsCalleeDao.selectCallee(calleeApplication, range);
logger.debug("Found Callee. count={}, callee={}", callee.size(), calleeApplication);
final LinkDataDuplexMap calleeSet = new LinkDataDuplexMap();
for (LinkData stat : callee.getLinkDataList()) {
calleeSet.addTargetLinkData(stat);
// search depth check
final SearchDepth nextLevel = searchDepth.nextDepth();
if (nextLevel.isDepthOverflow()) {
continue;
}
// need to find the applications that called me
LinkDataDuplexMap calleeSub = selectCallee(stat.getFromApplication(), range, nextLevel);
calleeSet.addLinkDataDuplexMap(calleeSub);
// find all callees of queried subCallees as well
for (LinkData eachCallee : calleeSub.getTargetLinkDataList()) {
// skip if terminal node
final Application eachCalleeToApplication = eachCallee.getToApplication();
if (eachCalleeToApplication.getServiceType().isTerminal() || eachCalleeToApplication.getServiceType().isUnknown()) {
continue;
}
LinkDataDuplexMap callerSub = selectCaller(eachCalleeToApplication, range, nextLevel);
calleeSet.addLinkDataDuplexMap(callerSub);
}
}
return calleeSet;
}
use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.
the class DFSLinkSelector method checkRpcCallAccepted.
private List<LinkData> checkRpcCallAccepted(LinkData linkData, Range range) {
// replace if the rpc client's destination has an agent installed and thus has an application name
final Application toApplication = linkData.getToApplication();
if (!toApplication.getServiceType().isRpcClient()) {
return Collections.singletonList(linkData);
}
logger.debug("checkRpcCallAccepted(). Find applicationName:{} {}", toApplication, range);
final Set<AcceptApplication> acceptApplicationList = findAcceptApplication(linkData.getFromApplication(), toApplication.getName(), range);
logger.debug("find accept application:{}", acceptApplicationList);
if (CollectionUtils.isNotEmpty(acceptApplicationList)) {
if (acceptApplicationList.size() == 1) {
logger.debug("Application info replaced. {} => {}", linkData, acceptApplicationList);
AcceptApplication first = acceptApplicationList.iterator().next();
final LinkData acceptedLinkData = new LinkData(linkData.getFromApplication(), first.getApplication());
acceptedLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
return Collections.singletonList(acceptedLinkData);
} else {
// special case - there are more than 2 nodes grouped by a single url
return createVirtualLinkData(linkData, toApplication, acceptApplicationList);
}
} else {
final Application unknown = new Application(toApplication.getName(), ServiceType.UNKNOWN);
final LinkData unknownLinkData = new LinkData(linkData.getFromApplication(), unknown);
unknownLinkData.setLinkCallDataMap(linkData.getLinkCallDataMap());
return Collections.singletonList(unknownLinkData);
}
}
use of com.navercorp.pinpoint.web.vo.Application 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.Application in project pinpoint by naver.
the class DFSLinkSelector method selectCaller.
/**
* Queries for all applications(callee) called by the callerApplication
*
* @param callerApplication
* @param range
* @return
*/
private LinkDataDuplexMap selectCaller(Application callerApplication, Range range, SearchDepth searchDepth) {
// skip if the callerApplication has already been checked
if (linkVisitChecker.visitCaller(callerApplication)) {
return new LinkDataDuplexMap();
}
LinkDataMap caller = mapStatisticsCallerDao.selectCaller(callerApplication, range);
if (logger.isDebugEnabled()) {
logger.debug("Found Caller. count={}, caller={}", caller.size(), callerApplication);
}
final LinkDataMap replaceRpcCaller = new LinkDataMap();
for (LinkData callerLink : caller.getLinkDataList()) {
final List<LinkData> checkedLink = checkRpcCallAccepted(callerLink, range);
for (LinkData linkData : checkedLink) {
replaceRpcCaller.addLinkData(linkData);
}
}
final LinkDataDuplexMap resultCaller = new LinkDataDuplexMap();
for (LinkData link : replaceRpcCaller.getLinkDataList()) {
resultCaller.addSourceLinkData(link);
final Application toApplication = link.getToApplication();
// skip if toApplication is a terminal or an unknown cloud
if (toApplication.getServiceType().isTerminal() || toApplication.getServiceType().isUnknown()) {
continue;
}
// search depth check
final SearchDepth nextLevel = searchDepth.nextDepth();
if (nextLevel.isDepthOverflow()) {
continue;
}
logger.debug(" Find subCaller of {}", toApplication);
LinkDataDuplexMap callerSub = selectCaller(toApplication, range, nextLevel);
logger.debug(" Found subCaller. count={}, caller={}", callerSub.size(), toApplication);
resultCaller.addLinkDataDuplexMap(callerSub);
// find all callers of queried subCallers as well
for (LinkData eachCaller : callerSub.getSourceLinkDataList()) {
logger.debug(" Find callee of {}", eachCaller.getFromApplication());
LinkDataDuplexMap calleeSub = selectCallee(eachCaller.getFromApplication(), range, nextLevel);
logger.debug(" Found subCallee. count={}, callee={}", calleeSub.size(), eachCaller.getFromApplication());
resultCaller.addLinkDataDuplexMap(calleeSub);
}
}
return resultCaller;
}
Aggregations