Search in sources :

Example 1 with SpanAcceptor

use of com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor 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 SpanAcceptor

use of com.navercorp.pinpoint.web.filter.visitor.SpanAcceptor 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)

Example 3 with SpanAcceptor

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

the class WasToUnknownFilter method include.

public boolean include(LinkContext spanContainer) {
    /*
         * WAS -> UNKNOWN
         */
    final List<SpanBo> fromNode = spanContainer.findFromNode();
    if (!rpcUrlFilter.accept(fromNode)) {
        return false;
    }
    SpanAcceptor acceptor = new SpanReader(fromNode);
    return acceptor.accept(new SpanEventVisitor() {

        @Override
        public boolean visit(SpanEventBo spanEventBo) {
            return filter(spanEventBo, spanContainer);
        }
    });
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) 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 4 with SpanAcceptor

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

the class WasToBackendFilter method include.

public boolean include(LinkContext linkContext) {
    final List<SpanBo> fromNode = linkContext.findFromNode();
    SpanAcceptor acceptor = new SpanReader(fromNode);
    return acceptor.accept(new SpanEventVisitor() {

        @Override
        public boolean visit(SpanEventBo spanEventBo) {
            return filter(spanEventBo, linkContext);
        }
    });
}
Also used : SpanReader(com.navercorp.pinpoint.web.filter.visitor.SpanReader) 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)

Aggregations

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