Search in sources :

Example 36 with SpanEventBo

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

the class GrpcSpanBinder method bindSpanEventBoList.

public List<SpanEventBo> bindSpanEventBoList(List<PSpanEvent> spanEventList) {
    if (CollectionUtils.isEmpty(spanEventList)) {
        return Collections.emptyList();
    }
    List<SpanEventBo> spanEventBoList = new ArrayList<>(spanEventList.size());
    SpanEventBo prevSpanEvent = null;
    for (PSpanEvent pSpanEvent : spanEventList) {
        final SpanEventBo spanEventBo = buildSpanEventBo(pSpanEvent, prevSpanEvent);
        spanEventBoList.add(spanEventBo);
        prevSpanEvent = spanEventBo;
    }
    spanEventBoList.sort(SpanEventComparator.INSTANCE);
    return spanEventBoList;
}
Also used : ArrayList(java.util.ArrayList) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 37 with SpanEventBo

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

the class SpanReader method accept.

public boolean accept(SpanVisitor spanVisitor) {
    Objects.requireNonNull(spanVisitor, "spanVisitor");
    if (CollectionUtils.isEmpty(spanBoList)) {
        return SpanVisitor.REJECT;
    }
    for (SpanBo spanBo : spanBoList) {
        if (spanVisitor.visit(spanBo)) {
            return SpanVisitor.ACCEPT;
        }
        final List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
        if (visitSpanEventList(spanVisitor, spanEventBoList)) {
            return SpanVisitor.ACCEPT;
        }
        List<SpanChunkBo> spanChunkBoList = spanBo.getSpanChunkBoList();
        if (CollectionUtils.hasLength(spanChunkBoList)) {
            for (SpanChunkBo spanChunkBo : spanChunkBoList) {
                if (spanVisitor.visit(spanChunkBo)) {
                    return SpanVisitor.ACCEPT;
                }
                List<SpanEventBo> spanChunkEventBoList = spanChunkBo.getSpanEventBoList();
                if (visitSpanEventList(spanVisitor, spanChunkEventBoList)) {
                    return SpanVisitor.ACCEPT;
                }
            }
        }
    }
    return SpanVisitor.REJECT;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 38 with SpanEventBo

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

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

the class LinkFilterTest method wasToQueueFilter.

@Test
public void wasToQueueFilter() {
    final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName(TOMCAT_TYPE_NAME);
    final ServiceType messageQueue = serviceTypeRegistryService.findServiceTypeByName(MESSAGE_QUEUE_TYPE_NAME);
    final String messageQueueA = "QUEUE_A";
    final String messageQueueB = "QUEUE_B";
    FilterDescriptor.FromNode fromNode = new FilterDescriptor.FromNode("APP_A", tomcat.getName(), null);
    FilterDescriptor.ToNode toNode = new FilterDescriptor.ToNode(messageQueueA, messageQueue.getName(), null);
    FilterDescriptor.SelfNode selfNode = new FilterDescriptor.SelfNode(null, null, null);
    FilterDescriptor.ResponseTime responseTime = new FilterDescriptor.ResponseTime(null, null);
    FilterDescriptor.Option option = mock(FilterDescriptor.Option.class);
    FilterDescriptor descriptor = new FilterDescriptor(fromNode, toNode, selfNode, responseTime, option);
    FilterHint hint = new FilterHint(Collections.emptyList());
    LinkFilter linkFilter = newLinkFilter(descriptor, hint);
    logger.debug(linkFilter.toString());
    SpanBo matchingSpan = new SpanBo();
    matchingSpan.setApplicationId("APP_A");
    matchingSpan.setApplicationServiceType(tomcat.getCode());
    SpanEventBo spanEventDestinationA = new SpanEventBo();
    spanEventDestinationA.setDestinationId(messageQueueA);
    spanEventDestinationA.setServiceType(MESSAGE_QUEUE_TYPE_CODE);
    matchingSpan.addSpanEvent(spanEventDestinationA);
    Assert.assertTrue(linkFilter.include(Collections.singletonList(matchingSpan)));
    SpanBo unmatchingSpan = new SpanBo();
    unmatchingSpan.setApplicationId("APP_A");
    unmatchingSpan.setApplicationServiceType(tomcat.getCode());
    SpanEventBo spanEventDestinationB = new SpanEventBo();
    spanEventDestinationB.setDestinationId(messageQueueB);
    spanEventDestinationB.setServiceType(MESSAGE_QUEUE_TYPE_CODE);
    unmatchingSpan.addSpanEvent(spanEventDestinationB);
    Assert.assertFalse(linkFilter.include(Collections.singletonList(unmatchingSpan)));
    Assert.assertTrue(linkFilter.include(Arrays.asList(matchingSpan, unmatchingSpan)));
    SpanBo bothSpan = new SpanBo();
    bothSpan.setApplicationId("APP_A");
    bothSpan.setApplicationServiceType(tomcat.getCode());
    bothSpan.addSpanEventBoList(Arrays.asList(spanEventDestinationA, spanEventDestinationB));
    Assert.assertTrue(linkFilter.include(Collections.singletonList(bothSpan)));
}
Also used : SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 40 with SpanEventBo

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

the class CallStackMock method pop.

public SpanEventBo pop() {
    final SpanEventBo spanEvent = peek();
    if (spanEvent != null) {
        stack[index - 1] = null;
        index--;
        final int endElapsed = (int) (currentTime - (spanBo.getStartTime() + spanEvent.getStartElapsed()));
        spanEvent.setEndElapsed(endElapsed);
    }
    return spanEvent;
}
Also used : 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