Search in sources :

Example 1 with TSpanChunk

use of com.navercorp.pinpoint.thrift.dto.TSpanChunk in project pinpoint by naver.

the class SpanStreamSendDataPlaner method getSpanChunkBuffer0.

private byte[] getSpanChunkBuffer0() {
    if (spanChunkBuffer == null) {
        final TSpanChunk spanChunk = toSpanChunk(span);
        HeaderTBaseSerializer serializer = new HeaderTBaseSerializerFactory(false, SpanStreamSendDataFactory.DEFAULT_UDP_MAX_BUFFER_SIZE, false).createSerializer();
        byte[] spanChunkBuffer;
        try {
            spanChunkBuffer = serializer.serialize(spanChunk);
            this.spanChunkBuffer = spanChunkBuffer;
            this.spanChunkSize = serializer.getInterBufferSize();
        } catch (TException e) {
            logger.warn("Spanchunk serializer failed. {}.", spanChunk);
        }
    }
    if (spanChunkBuffer == null) {
        return new byte[0];
    }
    return spanChunkBuffer;
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) HeaderTBaseSerializer(com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializer) TException(org.apache.thrift.TException) HeaderTBaseSerializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory)

Example 2 with TSpanChunk

use of com.navercorp.pinpoint.thrift.dto.TSpanChunk in project pinpoint by naver.

the class SpanStreamSendDataPlaner method toSpanChunk.

private TSpanChunk toSpanChunk(TSpan span) {
    final TSpanChunk spanChunk = new TSpanChunk();
    spanChunk.setSpanEventList(Collections.EMPTY_LIST);
    spanChunk.setSpanEventListIsSet(true);
    spanChunk.setAgentId(span.getAgentId());
    spanChunk.setAgentIdIsSet(true);
    spanChunk.setApplicationName(span.getApplicationName());
    spanChunk.setApplicationNameIsSet(true);
    spanChunk.setAgentStartTime(span.getStartTime());
    spanChunk.setAgentStartTimeIsSet(true);
    spanChunk.setServiceType(span.getServiceType());
    spanChunk.setServiceTypeIsSet(true);
    spanChunk.setTransactionId(span.getTransactionId());
    spanChunk.setTransactionIdIsSet(true);
    spanChunk.setSpanId(span.getSpanId());
    spanChunk.setSpanIdIsSet(true);
    spanChunk.setEndPoint(span.getEndPoint());
    spanChunk.setEndPointIsSet(true);
    return spanChunk;
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk)

Example 3 with TSpanChunk

use of com.navercorp.pinpoint.thrift.dto.TSpanChunk in project pinpoint by naver.

the class SpanStreamSendDataSerializer method copySpanChunkWithoutSpanEvent.

private TSpanChunk copySpanChunkWithoutSpanEvent(TSpanChunk spanChunk) {
    TSpanChunk copiedSpanChunk = spanChunk.deepCopy();
    copiedSpanChunk.setSpanEventList(Collections.EMPTY_LIST);
    return copiedSpanChunk;
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk)

Example 4 with TSpanChunk

use of com.navercorp.pinpoint.thrift.dto.TSpanChunk in project pinpoint by naver.

the class SpanFactoryTest method testBuildSpanChunkBo.

@Test
public void testBuildSpanChunkBo() throws Exception {
    TSpanChunk tSpanChunk = random.randomTSpanChunk();
    TSpanEvent tSpanEvent1 = random.randomTSpanEvent((short) 0);
    TSpanEvent tSpanEvent2 = random.randomTSpanEvent((short) 1);
    TSpanEvent tSpanEvent3 = random.randomTSpanEvent((short) 5);
    TSpanEvent tSpanEvent4 = random.randomTSpanEvent((short) 2);
    tSpanChunk.setSpanEventList(Lists.newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
    SpanChunkBo spanChunkBo = spanFactory.buildSpanChunkBo(tSpanChunk);
    spanFactoryAssert.assertSpanChunk(tSpanChunk, spanChunkBo);
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Test(org.junit.Test)

Example 5 with TSpanChunk

use of com.navercorp.pinpoint.thrift.dto.TSpanChunk in project pinpoint by naver.

the class SpanEncoderTest method randomComplexSpanChunk.

public SpanChunkBo randomComplexSpanChunk() {
    TSpanChunk tSpanChunk = randomTSpan.randomTSpanChunk();
    TSpanEvent tSpanEvent1 = randomTSpan.randomTSpanEvent((short) 1);
    TSpanEvent tSpanEvent2 = randomTSpan.randomTSpanEvent((short) 2);
    TSpanEvent tSpanEvent3 = randomTSpan.randomTSpanEvent((short) 3);
    TSpanEvent tSpanEvent4 = randomTSpan.randomTSpanEvent((short) 5);
    tSpanChunk.setSpanEventList(newArrayList(tSpanEvent1, tSpanEvent2, tSpanEvent3, tSpanEvent4));
    return spanFactory.buildSpanChunkBo(tSpanChunk);
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Aggregations

TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)26 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)14 Test (org.junit.Test)13 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)5 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)4 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)4 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)3 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)3 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)2 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)2 ArrayList (java.util.ArrayList)2 TBase (org.apache.thrift.TBase)2 TypeLiteral (com.google.inject.TypeLiteral)1 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)1 Message (com.navercorp.pinpoint.io.request.Message)1 AsyncSpanChunk (com.navercorp.pinpoint.profiler.context.AsyncSpanChunk)1 LocalAsyncId (com.navercorp.pinpoint.profiler.context.LocalAsyncId)1 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)1