Search in sources :

Example 6 with SpanChunk

use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.

the class BasePinpointTest method getCurrentSpanEvents.

protected List<SpanEvent> getCurrentSpanEvents() {
    List<SpanEvent> spanEvents = new ArrayList<>();
    for (SpanType value : this.tBaseRecorder) {
        if (value instanceof SpanChunk) {
            final SpanChunk spanChunk = (SpanChunk) value;
            for (SpanEvent tSpanEvent : spanChunk.getSpanEventList()) {
                SpanEvent spanEvent = tSpanEvent;
                spanEvents.add(spanEvent);
            }
        }
    }
    return spanEvents;
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) ArrayList(java.util.ArrayList)

Example 7 with SpanChunk

use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.

the class ApplicationContextHandler method getExecutedMethod.

public List<String> getExecutedMethod() {
    List<String> list = new ArrayList<>();
    for (SpanType item : orderedSpanRecorder) {
        if (item instanceof Span) {
            Span span = (Span) item;
            List<SpanEvent> spanEventList = span.getSpanEventList();
            addApiDescription(list, spanEventList);
        } else if (item instanceof SpanChunk) {
            SpanChunk spanChunk = (SpanChunk) item;
            List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
            addApiDescription(list, spanEventList);
        }
    }
    return list;
}
Also used : SpanType(com.navercorp.pinpoint.profiler.context.SpanType) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) ArrayList(java.util.ArrayList) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) ArrayList(java.util.ArrayList) List(java.util.List) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 8 with SpanChunk

use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.

the class SpanStreamUDPSenderTest method createSpanChunk.

private SpanChunk createSpanChunk(int spanEventSize) throws InterruptedException {
    SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory("applicationName", "agentId", 0, ServiceType.STAND_ALONE);
    List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
    SpanChunk spanChunk = spanChunkFactory.create(originalSpanEventList);
    return spanChunk;
}
Also used : SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) DefaultSpanChunkFactory(com.navercorp.pinpoint.profiler.context.DefaultSpanChunkFactory) SpanChunkFactory(com.navercorp.pinpoint.profiler.context.SpanChunkFactory) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) DefaultSpanChunkFactory(com.navercorp.pinpoint.profiler.context.DefaultSpanChunkFactory)

Example 9 with SpanChunk

use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.

the class SpanStreamSendDataSerializerTest method spanStreamSendDataSerializerTest1.

@Test
public void spanStreamSendDataSerializerTest1() throws InterruptedException, TException {
    int spanEventSize = 10;
    SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
    HeaderTBaseSerializerFactory factory = new HeaderTBaseSerializerFactory();
    SpanChunk spanChunk = spanChunkFactory.create(createSpanEventList(spanEventSize));
    PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanChunkStream(factory.createSerializer(), spanChunk);
    Assert.assertEquals(spanEventSize + 1, partitionedByteBufferLocator.getPartitionedCount());
    HeaderTBaseDeserializer deserializer = new HeaderTBaseDeserializerFactory().createDeserializer();
    for (int i = 0; i < partitionedByteBufferLocator.getPartitionedCount(); i++) {
        ByteBuffer byteBuffer = partitionedByteBufferLocator.getByteBuffer(i);
        byte[] readBuffer = new byte[byteBuffer.remaining()];
        byteBuffer.get(readBuffer);
        Object o = deserializer.deserialize(readBuffer);
        if (o == null) {
            Assert.fail();
        }
        if (i < spanEventSize) {
            Assert.assertTrue(o instanceof TSpanEvent);
        } else {
            Assert.assertTrue(o instanceof TSpanChunk);
        }
    }
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) HeaderTBaseSerializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) HeaderTBaseDeserializer(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer) HeaderTBaseDeserializerFactory(com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory) ByteBuffer(java.nio.ByteBuffer) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Test(org.junit.Test)

Example 10 with SpanChunk

use of com.navercorp.pinpoint.profiler.context.SpanChunk in project pinpoint by naver.

the class SpanChunkStreamSendDataPlanerTest method spanChunkStreamSendDataPlanerTest.

@Test
public void spanChunkStreamSendDataPlanerTest() throws Exception {
    int spanEventSize = 10;
    SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
    HeaderTBaseSerializerFactory headerTBaseSerializerFactory = new HeaderTBaseSerializerFactory();
    List<SpanEvent> originalSpanEventList = createSpanEventList(spanEventSize);
    SpanChunk spanChunk = spanChunkFactory.create(originalSpanEventList);
    PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanChunkStream(headerTBaseSerializerFactory.createSerializer(), spanChunk);
    SpanStreamSendDataFactory factory = new SpanStreamSendDataFactory(100, 50, objectPool);
    List<TSpanEvent> spanEventList = getSpanEventList(partitionedByteBufferLocator, factory);
    partitionedByteBufferLocator = serializer.serializeSpanChunkStream(headerTBaseSerializerFactory.createSerializer(), spanChunk);
    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) SpanChunk(com.navercorp.pinpoint.profiler.context.SpanChunk) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) PartitionedByteBufferLocator(com.navercorp.pinpoint.profiler.sender.PartitionedByteBufferLocator) Test(org.junit.Test)

Aggregations

SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)13 Test (org.junit.Test)8 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)7 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)6 Span (com.navercorp.pinpoint.profiler.context.Span)6 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)6 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)6 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)5 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)5 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)5 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)3 DefaultAsyncSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultAsyncSpanChunk)3 DefaultLocalAsyncId (com.navercorp.pinpoint.profiler.context.DefaultLocalAsyncId)3 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 ArrayList (java.util.ArrayList)3 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)2 HeaderTBaseSerializerFactory (com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory)2 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)1