use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap in project pinpoint by naver.
the class BidirectionalLinkSelector method select.
@Override
public LinkDataDuplexMap select(List<Application> sourceApplications, Range range, int callerSearchDepth, int calleeSearchDepth) {
logger.debug("Creating link data map for {}", sourceApplications);
final SearchDepth callerDepth = new SearchDepth(callerSearchDepth);
final SearchDepth calleeDepth = new SearchDepth(calleeSearchDepth);
LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
List<Application> applications = filterApplications(sourceApplications);
LinkSelectContext linkSelectContext = new LinkSelectContext(range, callerDepth, calleeDepth, linkVisitChecker);
while (!applications.isEmpty()) {
logger.info("depth search start. callerDepth:{}, calleeDepth:{}, size:{}, nodes:{}", linkSelectContext.getCallerDepth(), linkSelectContext.getCalleeDepth(), applications.size(), applications);
LinkDataDuplexMap levelData = applicationsMapCreator.createLinkDataDuplexMap(applications, linkSelectContext);
logger.info("depth search end. callerDepth:{}, calleeDepth:{}", linkSelectContext.getCallerDepth(), linkSelectContext.getCalleeDepth());
linkDataDuplexMap.addLinkDataDuplexMap(levelData);
List<Application> nextApplications = linkSelectContext.getNextApplications();
applications = filterApplications(nextApplications);
linkSelectContext = linkSelectContext.advance();
}
return virtualLinkHandler.processVirtualLinks(linkDataDuplexMap, linkVisitChecker, range);
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap in project pinpoint by naver.
the class DefaultApplicationsMapCreator method createSerial.
private LinkDataDuplexMap createSerial(List<Application> applications, LinkSelectContext linkSelectContext) {
final LinkDataDuplexMap resultMap = new LinkDataDuplexMap();
for (Application application : applications) {
LinkDataDuplexMap searchResult = applicationMapCreator.createMap(application, linkSelectContext);
resultMap.addLinkDataDuplexMap(searchResult);
}
logger.debug("depth search. callerDepth : {}, calleeDepth : {}", linkSelectContext.getCallerDepth(), linkSelectContext.getCalleeDepth());
return resultMap;
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap in project pinpoint by naver.
the class DefaultApplicationsMapCreator method createParallel.
private LinkDataDuplexMap createParallel(List<Application> applications, LinkSelectContext linkSelectContext) {
final Set<LinkDataDuplexMap> searchResults = Sets.newConcurrentHashSet();
CompletableFuture[] futures = getLinkDataMapFutures(searchResults, applications, linkSelectContext);
CompletableFuture.allOf(futures).join();
LinkDataDuplexMap resultMap = new LinkDataDuplexMap();
for (LinkDataDuplexMap searchResult : searchResults) {
resultMap.addLinkDataDuplexMap(searchResult);
}
logger.debug("depth search. callerDepth : {}, calleeDepth : {}", linkSelectContext.getCallerDepth(), linkSelectContext.getCalleeDepth());
return resultMap;
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap in project pinpoint by naver.
the class DefaultApplicationsMapCreator method getLinkDataMapFutures.
private CompletableFuture[] getLinkDataMapFutures(Set<LinkDataDuplexMap> searchResults, List<Application> targetApplicationList, LinkSelectContext linkSelectContext) {
List<CompletableFuture<Void>> linkDataDuplexMapFutures = new ArrayList<>();
for (Application targetApplication : targetApplicationList) {
CompletableFuture<LinkDataDuplexMap> linkDataDuplexMapFuture = CompletableFuture.supplyAsync(new Supplier<LinkDataDuplexMap>() {
@Override
public LinkDataDuplexMap get() {
return applicationMapCreator.createMap(targetApplication, linkSelectContext);
}
}, executor);
CompletableFuture<Void> searchResultsFuture = linkDataDuplexMapFuture.thenAccept(searchResults::add);
linkDataDuplexMapFutures.add(searchResultsFuture);
}
return linkDataDuplexMapFutures.toArray(new CompletableFuture[0]);
}
use of com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap in project pinpoint by naver.
the class DefaultApplicationMapCreator method createMap.
@Override
public LinkDataDuplexMap createMap(Application application, LinkSelectContext linkSelectContext) {
logger.debug("Finding Caller/Callee link data for {}", application);
final Range range = linkSelectContext.getRange();
LinkDataDuplexMap searchResult = new LinkDataDuplexMap();
final boolean searchCallerNode = linkSelectContext.checkNextCaller(application);
if (searchCallerNode) {
logger.debug("Finding Caller link data for {}", application);
final LinkDataMap callerLinkDataMap = linkDataMapService.selectCallerLinkDataMap(application, range);
logger.debug("Found Caller. count={}, caller={}, depth={}", callerLinkDataMap.size(), application, linkSelectContext.getCallerDepth());
final LinkDataMap processedCallerLinkDataMap = callerLinkDataMapProcessor.processLinkDataMap(callerLinkDataMap, range);
for (LinkData callerLinkData : processedCallerLinkDataMap.getLinkDataList()) {
searchResult.addSourceLinkData(callerLinkData);
final Application toApplication = callerLinkData.getToApplication();
// skip if nextApplication is a terminal or an unknown cloud
if (toApplication.getServiceType().isTerminal() || toApplication.getServiceType().isUnknown()) {
continue;
}
linkSelectContext.addNextApplication(toApplication);
}
}
final boolean searchCalleeNode = linkSelectContext.checkNextCallee(application);
if (searchCalleeNode) {
logger.debug("Finding Callee link data for {}", application);
final LinkDataMap calleeLinkDataMap = linkDataMapService.selectCalleeLinkDataMap(application, range);
logger.debug("Found Callee. count={}, callee={}, depth={}", calleeLinkDataMap.size(), application, linkSelectContext.getCalleeDepth());
final LinkDataMap processedCalleeLinkDataMap = calleeLinkDataMapProcessor.processLinkDataMap(calleeLinkDataMap, range);
for (LinkData calleeLinkData : processedCalleeLinkDataMap.getLinkDataList()) {
searchResult.addTargetLinkData(calleeLinkData);
final Application fromApplication = calleeLinkData.getFromApplication();
linkSelectContext.addNextApplication(fromApplication);
}
}
return searchResult;
}
Aggregations