Search in sources :

Example 81 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo 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)

Example 82 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class RpcURLPatternFilter method accept.

@Override
public boolean accept(List<SpanBo> fromSpanList) {
    for (SpanBo spanBo : fromSpanList) {
        final List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
        if (CollectionUtils.isEmpty(spanEventBoList)) {
            return REJECT;
        }
        for (SpanEventBo event : spanEventBoList) {
            final ServiceType eventServiceType = serviceTypeRegistryService.findServiceType(event.getServiceType());
            if (!eventServiceType.isRpcClient()) {
                continue;
            }
            if (!eventServiceType.isRecordStatistics()) {
                continue;
            }
            // http://api.domain.com/test/ArticleList.do
            // slice url ->/test/ArticleList.do
            final List<AnnotationBo> annotationBoList = event.getAnnotationBoList();
            if (annotationBoList == null) {
                continue;
            }
            for (AnnotationBo annotationBo : annotationBoList) {
                // TODO ?? url format & annotation type detect
                int key = annotationBo.getKey();
                if (isURL(key)) {
                    String url = (String) annotationBo.getValue();
                    String path = getPath(url);
                    final boolean match = matcher.match(urlPattern, path);
                    if (match) {
                        return ACCEPT;
                    }
                }
            }
        }
    }
    return REJECT;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 83 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class Node method buildAlignList.

private List<Align> buildAlignList(List<SpanEventBo> spanEventBoList) {
    if (CollectionUtils.isEmpty(spanEventBoList)) {
        return Collections.emptyList();
    }
    List<Align> alignList = new ArrayList<>();
    for (SpanEventBo spanEventBo : spanEventBoList) {
        if (logger.isDebugEnabled()) {
            logger.debug("Populate spanEvent{seq={}, depth={}, event={}}", spanEventBo.getSequence(), spanEventBo.getDepth(), spanEventBo);
        }
        final Align spanEventAlign = this.newSpanEventAlign(spanEventBo);
        alignList.add(spanEventAlign);
    }
    return alignList;
}
Also used : ArrayList(java.util.ArrayList) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 84 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class Node method buildSpanChunkBaseAligns.

private List<Align> buildSpanChunkBaseAligns(List<SpanChunkBo> spanChunkBoList) {
    if (CollectionUtils.isEmpty(spanChunkBoList)) {
        return Collections.emptyList();
    }
    List<Align> alignList = new ArrayList<>();
    for (SpanChunkBo chunkBo : spanChunkBoList) {
        if (chunkBo.isAsyncSpanChunk()) {
            // asyncSpanEvent
            continue;
        }
        List<SpanEventBo> spanEventList = chunkBo.getSpanEventBoList();
        for (SpanEventBo spanEventBo : spanEventList) {
            if (logger.isTraceEnabled()) {
                logger.trace("Populate spanEvent{seq={}, depth={}, event={}}", spanEventBo.getSequence(), spanEventBo.getDepth(), spanEventBo);
            }
            final Align spanEventAlign = this.newSpanEventAlign(chunkBo, spanEventBo);
            alignList.add(spanEventAlign);
        }
    }
    return alignList;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) ArrayList(java.util.ArrayList) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 85 with SpanEventBo

use of com.navercorp.pinpoint.common.server.bo.SpanEventBo in project pinpoint by naver.

the class SpanAsyncEventMap method add.

private boolean add(SpanBo spanBo, final SpanChunkBo spanChunkBo) {
    final LocalAsyncIdBo localAsyncId = spanChunkBo.getLocalAsyncId();
    if (localAsyncId == null) {
        return false;
    }
    List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    if (CollectionUtils.isEmpty(spanEventBoList)) {
        return false;
    }
    final List<Align> alignList = toAlignList(spanBo, spanChunkBo, spanEventBoList);
    final int id = localAsyncId.getAsyncId();
    Map<Integer, List<Align>> subMap = map.computeIfAbsent(id, k -> new HashMap<>());
    final int sequence = localAsyncId.getSequence();
    final List<Align> exist = subMap.get(sequence);
    if (exist != null) {
        exist.addAll(alignList);
    } else {
        subMap.put(sequence, alignList);
    }
    return true;
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Aggregations

SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)94 Test (org.junit.Test)39 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)26 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)14 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)13 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)11 ArrayList (java.util.ArrayList)11 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)9 ByteBuffer (java.nio.ByteBuffer)8 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)4 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)4 Header (com.navercorp.pinpoint.grpc.Header)4 PSpanChunk (com.navercorp.pinpoint.grpc.trace.PSpanChunk)4 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)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 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)3 SpanBitFiled (com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.bitfield.SpanBitFiled)3 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)3