use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.
the class FilteredMapServiceImpl method addNodeFromSpanEvent.
private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, LinkDataDuplexMap linkDataDuplexMap, Map<Long, SpanBo> transactionSpanMap) {
/*
* add span event statistics
*/
final List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventBoList)) {
return;
}
final Application srcApplication = applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
for (SpanEventBo spanEvent : spanEventBoList) {
ServiceType destServiceType = registry.findServiceType(spanEvent.getServiceType());
if (!destServiceType.isRecordStatistics()) {
// internal method
continue;
}
// logic for checking acceptor
if (destServiceType.isRpcClient()) {
if (!transactionSpanMap.containsKey(spanEvent.getNextSpanId())) {
destServiceType = ServiceType.UNKNOWN;
}
}
String dest = spanEvent.getDestinationId();
if (dest == null) {
dest = "Unknown";
}
final Application destApplication = this.applicationFactory.createApplication(dest, destServiceType);
final short slotTime = getHistogramSlotTime(spanEvent, destServiceType);
// FIXME
final long spanEventTimeStamp = window.refineTimestamp(span.getStartTime() + spanEvent.getStartElapsed());
if (logger.isTraceEnabled()) {
logger.trace("spanEvent src:{} {} -> dest:{} {}", srcApplication, span.getAgentId(), destApplication, spanEvent.getEndPoint());
}
// endPoint may be null
final String destinationAgentId = StringUtils.defaultString(spanEvent.getEndPoint());
sourceLinkDataMap.addLinkData(srcApplication, span.getAgentId(), destApplication, destinationAgentId, spanEventTimeStamp, slotTime, 1);
}
}
use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.
the class BFSLinkSelector method getUnvisitedEmulationNode.
private List<Application> getUnvisitedEmulationNode() {
Set<Application> unvisitedList = new HashSet<>();
for (LinkData linkData : this.emulationLinkMarker) {
Application toApplication = linkData.getToApplication();
boolean isVisited = this.linkVisitChecker.isVisitedCaller(toApplication);
if (!isVisited) {
unvisitedList.add(toApplication);
}
}
return new ArrayList<>(unvisitedList);
}
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);
}
}
Aggregations