Search in sources :

Example 1 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class BFSLinkSelector method findAcceptApplication.

private Set<AcceptApplication> findAcceptApplication(Application fromApplication, String host, Range range) {
    logger.debug("findAcceptApplication {} {}", fromApplication, host);
    final RpcApplication rpcApplication = new RpcApplication(host, fromApplication);
    final Set<AcceptApplication> hit = this.acceptApplicationLocalCache.get(rpcApplication);
    if (CollectionUtils.isNotEmpty(hit)) {
        logger.debug("acceptApplicationLocalCache hit {}", rpcApplication);
        return hit;
    }
    final Set<AcceptApplication> acceptApplicationSet = hostApplicationMapDao.findAcceptApplicationName(fromApplication, range);
    this.acceptApplicationLocalCache.put(rpcApplication, acceptApplicationSet);
    Set<AcceptApplication> acceptApplication = this.acceptApplicationLocalCache.get(rpcApplication);
    logger.debug("findAcceptApplication {}->{} result:{}", fromApplication, host, acceptApplication);
    return acceptApplication;
}
Also used : RpcApplication(com.navercorp.pinpoint.web.service.map.RpcApplication) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 2 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication 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);
        }
    }
}
Also used : AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) RpcApplication(com.navercorp.pinpoint.web.service.map.RpcApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 3 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication 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);
    }
}
Also used : AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) RpcApplication(com.navercorp.pinpoint.web.service.map.RpcApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 4 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class DFSLinkSelector method findAcceptApplication.

private Set<AcceptApplication> findAcceptApplication(Application fromApplication, String host, Range range) {
    logger.debug("findAcceptApplication {} {}", fromApplication, host);
    final RpcApplication rpcApplication = new RpcApplication(host, fromApplication);
    final Set<AcceptApplication> hit = this.acceptApplicationLocalCache.get(rpcApplication);
    if (CollectionUtils.isNotEmpty(hit)) {
        logger.debug("acceptApplicationLocalCache hit {}", rpcApplication);
        return hit;
    }
    final Set<AcceptApplication> acceptApplicationSet = hostApplicationMapDao.findAcceptApplicationName(fromApplication, range);
    this.acceptApplicationLocalCache.put(rpcApplication, acceptApplicationSet);
    Set<AcceptApplication> acceptApplication = this.acceptApplicationLocalCache.get(rpcApplication);
    logger.debug("findAcceptApplication {}->{} result:{}", fromApplication, host, acceptApplication);
    return acceptApplication;
}
Also used : RpcApplication(com.navercorp.pinpoint.web.service.map.RpcApplication) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Example 5 with AcceptApplication

use of com.navercorp.pinpoint.web.service.map.AcceptApplication in project pinpoint by naver.

the class RpcCallProcessor method replaceLinkData.

private List<LinkData> replaceLinkData(LinkData linkData, Range range) {
    final Application toApplication = linkData.getToApplication();
    if (toApplication.getServiceType().isRpcClient() || toApplication.getServiceType().isQueue()) {
        // rpc client's destination could have an agent installed in which case the link data must be replaced to point
        // to the destination application.
        logger.debug("Finding accept applications for {}, {}", toApplication, range);
        final Set<AcceptApplication> acceptApplicationList = findAcceptApplications(linkData.getFromApplication(), toApplication.getName(), range);
        logger.debug("Found accept applications: {}", acceptApplicationList);
        if (CollectionUtils.hasLength(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 virtualLinkMarker.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);
            }
        }
    }
    return Collections.singletonList(linkData);
}
Also used : LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication) Application(com.navercorp.pinpoint.web.vo.Application) AcceptApplication(com.navercorp.pinpoint.web.service.map.AcceptApplication)

Aggregations

AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)18 Application (com.navercorp.pinpoint.web.vo.Application)11 Test (org.junit.Test)6 LinkKey (com.navercorp.pinpoint.web.vo.LinkKey)5 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)4 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)4 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)3 VirtualLinkMarker (com.navercorp.pinpoint.web.service.map.VirtualLinkMarker)3 Range (com.navercorp.pinpoint.web.vo.Range)2 HashSet (java.util.HashSet)2 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cell (org.apache.hadoop.hbase.Cell)1 TableName (org.apache.hadoop.hbase.TableName)1 Scan (org.apache.hadoop.hbase.client.Scan)1