Search in sources :

Example 6 with SpanEventBo

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

the class SpanDecoder method decodeSpanEventBo.

public SpanEventBo decodeSpanEventBo(Buffer qualifier, Buffer valueBuffer, SpanDecodingContext decodingContext) {
    SpanEventBo spanEventBo = new SpanEventBo();
    long spanId = qualifier.readLong();
    decodingContext.setSpanId(spanId);
    short sequence = qualifier.readShort();
    int asyncId = -1;
    if (qualifier.hasRemaining()) {
        asyncId = qualifier.readInt();
    }
    short asyncSequence = -1;
    if (qualifier.hasRemaining()) {
        asyncSequence = qualifier.readShort();
    }
    spanEventBo.setSequence(sequence);
    spanEventBo.setAsyncId(asyncId);
    spanEventBo.setAsyncSequence(asyncSequence);
    readSpanEvent(spanEventBo, valueBuffer, decodingContext);
    if (logger.isDebugEnabled()) {
        logger.debug("read spanEvent :{}", spanEventBo);
    }
    return spanEventBo;
}
Also used : SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 7 with SpanEventBo

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

the class SpanDecoderV0 method readSpanEvent.

private List<SpanEventBo> readSpanEvent(Buffer buffer, SpanEventBo firstSpanEvent, SpanDecodingContext decodingContext) {
    final int spanEventSize = buffer.readVInt();
    if (spanEventSize <= 0) {
        return new ArrayList<SpanEventBo>();
    }
    final List<SpanEventBo> spanEventBoList = new ArrayList<SpanEventBo>();
    SpanEventBo prev = null;
    for (int i = 0; i < spanEventSize; i++) {
        SpanEventBo spanEvent;
        if (i == 0) {
            spanEvent = readFirstSpanEvent(buffer, firstSpanEvent, decodingContext);
        } else {
            spanEvent = readNextSpanEvent(buffer, prev, decodingContext);
        }
        prev = spanEvent;
        spanEventBoList.add(spanEvent);
    }
    return spanEventBoList;
}
Also used : ArrayList(java.util.ArrayList) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Example 8 with SpanEventBo

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

the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_first_depth_zero.

@Test
public void buildSpanChunkBo_first_depth_zero() {
    final PSpanChunk chunk = newSpanChunk_first_depth_zero();
    final Header header = newHeader();
    SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
    List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    SpanEventBo spanEventBo0 = spanEventBoList.get(0);
    SpanEventBo spanEventBo1 = spanEventBoList.get(1);
    Assert.assertEquals(0, spanEventBo0.getDepth());
    Assert.assertEquals(1, spanEventBo1.getDepth());
}
Also used : Header(com.navercorp.pinpoint.grpc.Header) SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) PSpanChunk(com.navercorp.pinpoint.grpc.trace.PSpanChunk) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 9 with SpanEventBo

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

the class CollectorGrpcSpanFactoryTest method buildSpanChunkBo_compact_depth_NPE.

@Test
public void buildSpanChunkBo_compact_depth_NPE() {
    final PSpanChunk chunk = newSpanChunk_compact_depth_error();
    final Header header = newHeader();
    SpanChunkBo spanChunkBo = factory.buildSpanChunkBo(chunk, header);
    List<SpanEventBo> spanEventBoList = spanChunkBo.getSpanEventBoList();
    SpanEventBo spanEventBo0 = spanEventBoList.get(0);
    Assert.assertEquals(1, spanEventBo0.getDepth());
}
Also used : Header(com.navercorp.pinpoint.grpc.Header) SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) PSpanChunk(com.navercorp.pinpoint.grpc.trace.PSpanChunk) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

Example 10 with SpanEventBo

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

the class SpanEncoderTest method testEncodeSpanColumnValue_spanEvent_service_equals.

@Test
public void testEncodeSpanColumnValue_spanEvent_service_equals() {
    SpanBo spanBo = randomComplexSpan();
    SpanEventBo spanEventBo0 = spanBo.getSpanEventBoList().get(0);
    SpanEventBo spanEventBo1 = spanBo.getSpanEventBoList().get(1);
    spanEventBo1.setServiceType(spanEventBo0.getServiceType());
    assertSpan(spanBo);
}
Also used : SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo) Test(org.junit.Test)

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