Search in sources :

Example 11 with TSpanEvent

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

the class SpanChunkStreamSendDataPlanerTest method deserialize.

private List<TSpanEvent> deserialize(byte[] data) throws TException {
    ByteBuffer bb = ByteBuffer.wrap(data);
    bb.get();
    bb.get();
    int chunkSize = bb.get();
    List<TSpanEvent> eventList = new ArrayList<TSpanEvent>();
    for (int i = 0; i < chunkSize; i++) {
        short componentSize = bb.getShort();
        byte[] component = new byte[componentSize];
        bb.get(component);
        HeaderTBaseDeserializer deserialize = new HeaderTBaseDeserializerFactory().createDeserializer();
        List<TBase<?, ?>> value = deserialize.deserializeList(component);
        for (int j = 0; j < value.size(); j++) {
            TBase tbase = value.get(j);
            if (tbase instanceof TSpanEvent) {
                eventList.add((TSpanEvent) tbase);
            } else {
            }
        }
    }
    return eventList;
}
Also used : ArrayList(java.util.ArrayList) TBase(org.apache.thrift.TBase) ByteBuffer(java.nio.ByteBuffer) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) HeaderTBaseDeserializer(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer) HeaderTBaseDeserializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory)

Example 12 with TSpanEvent

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

the class SpanStreamSendDataPlanerTest method deserialize.

private List<TSpanEvent> deserialize(byte[] data) throws TException {
    ByteBuffer bb = ByteBuffer.wrap(data);
    bb.get();
    bb.get();
    int chunkSize = bb.get();
    List<TSpanEvent> eventList = new ArrayList<TSpanEvent>();
    for (int i = 0; i < chunkSize; i++) {
        short componentSize = bb.getShort();
        byte[] component = new byte[componentSize];
        bb.get(component);
        HeaderTBaseDeserializer deserialize = new HeaderTBaseDeserializerFactory().createDeserializer();
        List<TBase<?, ?>> value = deserialize.deserializeList(component);
        for (int j = 0; j < value.size(); j++) {
            TBase tbase = value.get(j);
            if (tbase instanceof TSpanEvent) {
                eventList.add((TSpanEvent) tbase);
            } else {
            }
        }
    }
    return eventList;
}
Also used : ArrayList(java.util.ArrayList) TBase(org.apache.thrift.TBase) ByteBuffer(java.nio.ByteBuffer) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) HeaderTBaseDeserializer(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer) HeaderTBaseDeserializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory)

Example 13 with TSpanEvent

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

the class SpanStreamSendDataPlanerTest method spanStreamSendDataPlanerTest.

@Test
public void spanStreamSendDataPlanerTest() throws Exception {
    int spanEventSize = 10;
    SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
    HeaderTBaseSerializerFactory headerTBaseSerializerFactory = new HeaderTBaseSerializerFactory();
    List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
    Span span = createSpan(originalSpanEventList);
    PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanStream(headerTBaseSerializerFactory.createSerializer(), span);
    SpanStreamSendDataFactory factory = new SpanStreamSendDataFactory(100, 50, objectPool);
    List<TSpanEvent> spanEventList = getSpanEventList(partitionedByteBufferLocator, factory);
    partitionedByteBufferLocator = serializer.serializeSpanStream(headerTBaseSerializerFactory.createSerializer(), span);
    factory = new SpanStreamSendDataFactory(objectPool);
    List<TSpanEvent> spanEventList2 = getSpanEventList(partitionedByteBufferLocator, factory);
    Assert.assertEquals(spanEventSize, spanEventList.size());
    Assert.assertEquals(spanEventSize, spanEventList2.size());
}
Also used : SpanStreamSendDataFactory(com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataFactory) SpanStreamSendDataSerializer(com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataSerializer) HeaderTBaseSerializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) PartitionedByteBufferLocator(com.navercorp.pinpoint.profiler.sender.PartitionedByteBufferLocator) Test(org.junit.Test)

Example 14 with TSpanEvent

use of com.navercorp.pinpoint.thrift.dto.TSpanEvent 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(Lists.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)

Example 15 with TSpanEvent

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

the class SpanFactoryTest method testNewSpanEventBo.

@Test
public void testNewSpanEventBo() throws Exception {
    TSpanEvent tSpanEvent = random.randomTSpanEvent((short) RandomUtils.nextInt(0, 100));
    SpanEventBo spanEventBo = spanFactory.buildSpanEventBo(tSpanEvent);
    spanFactoryAssert.assertSpanEvent(tSpanEvent, spanEventBo);
}
Also used : TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Test(org.junit.Test)

Aggregations

TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)30 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)9 ByteBuffer (java.nio.ByteBuffer)8 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)7 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)6 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)4 HeaderTBaseDeserializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory)4 HeaderTBaseSerializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory)4 Span (com.navercorp.pinpoint.profiler.context.Span)3 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)3 TransactionId (com.navercorp.pinpoint.common.util.TransactionId)2 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)2 PartitionedByteBufferLocator (com.navercorp.pinpoint.profiler.sender.PartitionedByteBufferLocator)2 SpanStreamSendData (com.navercorp.pinpoint.profiler.sender.SpanStreamSendData)2 SpanStreamSendDataFactory (com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataFactory)2 SpanStreamSendDataSerializer (com.navercorp.pinpoint.profiler.sender.SpanStreamSendDataSerializer)2 TBase (org.apache.thrift.TBase)2 TException (org.apache.thrift.TException)2 RandomTSpan (com.navercorp.pinpoint.common.server.bo.RandomTSpan)1