Search in sources :

Example 21 with LinkDataDuplexMap

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);
}
Also used : SearchDepth(com.navercorp.pinpoint.web.service.SearchDepth) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Application(com.navercorp.pinpoint.web.vo.Application)

Example 22 with LinkDataDuplexMap

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;
}
Also used : LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Application(com.navercorp.pinpoint.web.vo.Application)

Example 23 with LinkDataDuplexMap

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;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)

Example 24 with LinkDataDuplexMap

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]);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) ArrayList(java.util.ArrayList) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Application(com.navercorp.pinpoint.web.vo.Application)

Example 25 with LinkDataDuplexMap

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;
}
Also used : LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Aggregations

LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)35 Application (com.navercorp.pinpoint.web.vo.Application)26 Range (com.navercorp.pinpoint.web.vo.Range)24 Test (org.junit.Test)22 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)15 NodeList (com.navercorp.pinpoint.web.applicationmap.nodes.NodeList)10 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)10 LinkKey (com.navercorp.pinpoint.web.vo.LinkKey)9 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)7 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)4 ApplicationMap (com.navercorp.pinpoint.web.applicationmap.ApplicationMap)3 ApplicationMapBuilder (com.navercorp.pinpoint.web.applicationmap.ApplicationMapBuilder)3 DefaultNodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.DefaultNodeHistogramFactory)3 NodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)3 DefaultServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.DefaultServerInstanceListFactory)3 ServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory)3 ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)3 LinkSelector (com.navercorp.pinpoint.web.service.map.LinkSelector)3 LinkDataMapProcessor (com.navercorp.pinpoint.web.service.map.processor.LinkDataMapProcessor)3 ArrayList (java.util.ArrayList)3