Search in sources :

Example 91 with SpanEventBo

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

the class LinkFilterTest method wasToUnknownFilter.

@Test
public void wasToUnknownFilter() {
    final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName(TOMCAT_TYPE_NAME);
    final ServiceType unknown = serviceTypeRegistryService.findServiceTypeByName(UNKNOWN_TYPE_NAME);
    final String rpcHost = "some.domain.name";
    final String rpcUrl = "http://" + rpcHost + "/some/test/path";
    final String urlPattern = "/some/test/**";
    FilterDescriptor.FromNode fromNode = new FilterDescriptor.FromNode("APP_A", tomcat.getName(), null);
    FilterDescriptor.ToNode toNode = new FilterDescriptor.ToNode(rpcHost, unknown.getName(), null);
    FilterDescriptor.SelfNode selfNode = new FilterDescriptor.SelfNode(null, null, null);
    FilterDescriptor.Option option = new FilterDescriptor.Option(encodeUrl(urlPattern), null);
    FilterDescriptor.ResponseTime responseTime = new FilterDescriptor.ResponseTime(null, null);
    FilterDescriptor descriptor = new FilterDescriptor(fromNode, toNode, selfNode, responseTime, option);
    FilterHint hint = new FilterHint(Collections.emptyList());
    LinkFilter linkFilter = newLinkFilter(descriptor, hint);
    logger.debug(linkFilter.toString());
    // Reject - no rpc span event
    SpanBo spanBo = new SpanBo();
    spanBo.setSpanId(1);
    spanBo.setParentSpanId(-1);
    spanBo.setApplicationId("APP_A");
    spanBo.setApplicationServiceType(tomcat.getCode());
    Assert.assertFalse(linkFilter.include(Collections.singletonList(spanBo)));
    // Accept - has matching rpc span event
    AnnotationBo rpcAnnotation = new AnnotationBo(RPC_ANNOTATION_CODE, rpcUrl);
    SpanEventBo rpcSpanEvent = new SpanEventBo();
    rpcSpanEvent.setServiceType(RPC_TYPE_CODE);
    rpcSpanEvent.setDestinationId(rpcHost);
    rpcSpanEvent.setAnnotationBoList(Collections.singletonList(rpcAnnotation));
    spanBo.addSpanEvent(rpcSpanEvent);
    Assert.assertTrue(linkFilter.include(Collections.singletonList(spanBo)));
}
Also used : SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 92 with SpanEventBo

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

the class RpcURLPatternFilterTest method createTestRpcSpans.

private List<SpanBo> createTestRpcSpans(String... rpcUrls) {
    List<SpanBo> spanBos = new ArrayList<>();
    for (String rpcUrl : rpcUrls) {
        SpanEventBo testRpcSpanEvent = new SpanEventBo();
        testRpcSpanEvent.setServiceType(TEST_RPC_SERVICE_TYPE_CODE);
        AnnotationBo testRpcAnnotationBo = new AnnotationBo(TEST_RPC_URL_ANNOTATION_KEY.getCode(), rpcUrl);
        testRpcSpanEvent.setAnnotationBoList(Collections.singletonList(testRpcAnnotationBo));
        SpanBo spanBo = new SpanBo();
        spanBo.addSpanEvent(testRpcSpanEvent);
        spanBos.add(spanBo);
    }
    return spanBos;
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 93 with SpanEventBo

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

the class CallStackMock method push.

public void push() {
    final SpanEventBo spanEvent = new SpanEventBo();
    final int startElapsed = (int) (currentTime - spanBo.getStartTime());
    currentTime++;
    spanEvent.setStartElapsed(startElapsed);
    spanEvent.setSequence(sequence++);
    checkExtend(index + 1);
    stack[index++] = spanEvent;
    if (this.latestStackIndex != this.index) {
        this.latestStackIndex = this.index;
        spanEvent.setDepth(this.latestStackIndex);
    }
    final SpanEventAlign spanEventAlign;
    if (this.async) {
        LocalAsyncIdBo localAsyncIdBo = new LocalAsyncIdBo(asyncId, 1);
        SpanChunkBo spanChunkBo = new SpanChunkBo();
        spanChunkBo.setLocalAsyncId(localAsyncIdBo);
        spanEventAlign = new SpanChunkEventAlign(spanBo, spanChunkBo, spanEvent);
    } else {
        spanEventAlign = new SpanEventAlign(spanBo, spanEvent);
    }
    callTree.add(spanEvent.getDepth(), spanEventAlign);
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 94 with SpanEventBo

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

the class SpanAlignerTest method makeSpanEvent.

private SpanEventBo makeSpanEvent(int sequence, int depth, int nextSpanId, int endElapsed) {
    SpanEventBo event = new SpanEventBo();
    event.setSequence((short) sequence);
    event.setDepth(depth);
    event.setNextSpanId(nextSpanId);
    event.setEndElapsed(endElapsed);
    return event;
}
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