Search in sources :

Example 36 with Application

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);
    }
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) Application(com.navercorp.pinpoint.web.vo.Application) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 37 with Application

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

Example 38 with Application

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);
        }
    }
}
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 39 with Application

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

Example 40 with Application

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);
    }
}
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)

Aggregations

Application (com.navercorp.pinpoint.web.vo.Application)90 Test (org.junit.Test)39 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)30 MapStatisticsCallerDataCollector (com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector)15 ResponseTimeDataCollector (com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector)11 AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)11 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)10 Range (com.navercorp.pinpoint.web.vo.Range)10 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)5 List (java.util.List)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 AgentStatDataCollector (com.navercorp.pinpoint.web.alarm.collector.AgentStatDataCollector)4 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)4 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)4 ArrayList (java.util.ArrayList)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 ErrorCountToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorCountToCalleeChecker)3 ErrorRateToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorRateToCalleeChecker)3