Search in sources :

Example 16 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class TotalCountToCalleeCheckerTest method checkTest3.

@Test
public void checkTest3() {
    Application application = new Application(FROM_SERVICE_NAME, ServiceType.STAND_ALONE);
    MapStatisticsCallerDataCollector dataCollector = new MapStatisticsCallerDataCollector(DataCollectorCategory.CALLER_STAT, application, dao, System.currentTimeMillis(), 300000);
    Rule rule = new Rule(FROM_SERVICE_NAME, SERVICE_TYPE, CheckerCategory.TOTAL_COUNT_TO_CALLEE.getName(), 10, "testGroup", false, false, TO_SERVICE_NAME + 2);
    TotalCountToCalleeChecker checker = new TotalCountToCalleeChecker(dataCollector, rule);
    checker.check();
    assertTrue(checker.isDetected());
}
Also used : MapStatisticsCallerDataCollector(com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 17 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class FilteredMapServiceImpl method createMap.

private ApplicationMap createMap(Range range, Range scanRange, List<List<SpanBo>> filterList) {
    // TODO inject TimeWindow from elsewhere 
    final TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
    final LinkDataDuplexMap linkDataDuplexMap = new LinkDataDuplexMap();
    final ResponseHistogramBuilder mapHistogramSummary = new ResponseHistogramBuilder(range);
    /*
         * Convert to statistical data
         */
    for (List<SpanBo> transaction : filterList) {
        final Map<Long, SpanBo> transactionSpanMap = checkDuplicatedSpanId(transaction);
        for (SpanBo span : transaction) {
            final Application parentApplication = createParentApplication(span, transactionSpanMap);
            final Application spanApplication = this.applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
            // records the Span's response time statistics
            recordSpanResponseTime(spanApplication, span, mapHistogramSummary, span.getCollectorAcceptTime());
            if (!spanApplication.getServiceType().isRecordStatistics() || spanApplication.getServiceType().isRpcClient()) {
                // span's serviceType is probably not set correctly
                logger.warn("invalid span application:{}", spanApplication);
                continue;
            }
            final short slotTime = getHistogramSlotTime(span, spanApplication.getServiceType());
            // might need to reconsider using collector's accept time for link statistics.
            // we need to convert to time window's timestamp. If not, it may lead to OOM due to mismatch in timeslots. 
            long timestamp = window.refineTimestamp(span.getCollectorAcceptTime());
            if (parentApplication.getServiceType() == ServiceType.USER) {
                // Outbound data
                if (logger.isTraceEnabled()) {
                    logger.trace("span user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                final LinkDataMap sourceLinkData = linkDataDuplexMap.getSourceLinkDataMap();
                sourceLinkData.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
                if (logger.isTraceEnabled()) {
                    logger.trace("span target user:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                // Inbound data
                final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
                targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
            } else {
                // Inbound data
                if (logger.isTraceEnabled()) {
                    logger.trace("span target parent:{} {} -> span:{} {}", parentApplication, span.getAgentId(), spanApplication, span.getAgentId());
                }
                final LinkDataMap targetLinkDataMap = linkDataDuplexMap.getTargetLinkDataMap();
                targetLinkDataMap.addLinkData(parentApplication, span.getAgentId(), spanApplication, span.getAgentId(), timestamp, slotTime, 1);
            }
            if (serverMapDataFilter != null && serverMapDataFilter.filter(spanApplication)) {
                continue;
            }
            addNodeFromSpanEvent(span, window, linkDataDuplexMap, transactionSpanMap);
        }
    }
    ApplicationMapBuilder applicationMapBuilder = new ApplicationMapBuilder(range);
    mapHistogramSummary.build();
    ApplicationMap map = applicationMapBuilder.build(linkDataDuplexMap, agentInfoService, mapHistogramSummary);
    if (serverMapDataFilter != null) {
        map = serverMapDataFilter.dataFiltering(map);
    }
    return map;
}
Also used : ApplicationMap(com.navercorp.pinpoint.web.applicationmap.ApplicationMap) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) TimeWindow(com.navercorp.pinpoint.web.util.TimeWindow) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) ApplicationMapBuilder(com.navercorp.pinpoint.web.applicationmap.ApplicationMapBuilder) ResponseHistogramBuilder(com.navercorp.pinpoint.web.vo.ResponseHistogramBuilder) Application(com.navercorp.pinpoint.web.vo.Application) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Example 18 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class FilteredMapServiceImpl method createDotExtractor.

private DotExtractor createDotExtractor(Range scanRange, List<List<SpanBo>> filterList) {
    final DotExtractor dotExtractor = new DotExtractor(scanRange, applicationFactory);
    for (List<SpanBo> transaction : filterList) {
        for (SpanBo span : transaction) {
            final Application spanApplication = this.applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
            if (!spanApplication.getServiceType().isRecordStatistics() || spanApplication.getServiceType().isRpcClient()) {
                continue;
            }
            dotExtractor.addDot(span);
        }
    }
    return dotExtractor;
}
Also used : SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Application(com.navercorp.pinpoint.web.vo.Application)

Example 19 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 20 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)

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