Search in sources :

Example 1 with SpanEventVisitAdaptor

use of com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor in project pinpoint by naver.

the class FilteredMapBuilder method getParentsSpan.

private SpanBo getParentsSpan(SpanBo currentSpan, MultiValueMap<Long, SpanBo> transactionSpanMap) {
    List<SpanBo> parentSpanCandidateList = transactionSpanMap.get(currentSpan.getParentSpanId());
    if (parentSpanCandidateList == null) {
        return null;
    }
    if (CollectionUtils.nullSafeSize(parentSpanCandidateList) == 1) {
        return parentSpanCandidateList.get(0);
    } else {
        for (SpanBo parentSpanCandidate : parentSpanCandidateList) {
            SpanAcceptor acceptor = new SpanReader(Collections.singletonList(parentSpanCandidate));
            boolean accept = acceptor.accept(new SpanEventVisitAdaptor(new SpanEventVisitor() {

                @Override
                public boolean visit(SpanEventBo spanEventBo) {
                    if (spanEventBo.getNextSpanId() == currentSpan.getSpanId()) {
                        return SpanVisitor.ACCEPT;
                    }
                    return SpanVisitor.REJECT;
                }
            }));
            if (accept) {
                return parentSpanCandidate;
            }
        }
        logger.warn("Can not find suitable ParentSpan.(CurrentSpan:{})", currentSpan);
        return parentSpanCandidateList.get(0);
    }
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) SpanEventVisitAdaptor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanAcceptor(com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor) SpanEventVisitor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 2 with SpanEventVisitAdaptor

use of com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor in project pinpoint by naver.

the class FilteredMapBuilder method addNodeFromSpanEvent.

private void addNodeFromSpanEvent(SpanBo span, Application srcApplication, MultiValueMap<Long, SpanBo> transactionSpanMap) {
    /*
         * add span event statistics
         */
    LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
    SpanAcceptor acceptor = new SpanReader(Collections.singletonList(span));
    acceptor.accept(new SpanEventVisitAdaptor(new SpanEventVisitor() {

        @Override
        public boolean visit(SpanEventBo spanEventBo) {
            addNode(span, transactionSpanMap, srcApplication, sourceLinkDataMap, spanEventBo);
            return SpanVisitor.REJECT;
        }
    }));
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) SpanEventVisitAdaptor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor) SpanAcceptor(com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor) SpanEventVisitor(com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Aggregations

SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)2 SpanAcceptor (com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor)2 SpanEventVisitAdaptor (com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitAdaptor)2 SpanEventVisitor (com.navercorp.pinpoint.web.filter.visitor.SpanEventVisitor)2 SpanReader (com.navercorp.pinpoint.web.filter.visitor.SpanReader)2 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)1 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)1