Search in sources :

Example 1 with Span

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

the class SpanChunkStreamSendDataPlanerTest method createSpanEventList.

private List<SpanEvent> createSpanEventList(int size) throws InterruptedException {
    Span span = new Span();
    List<SpanEvent> spanEventList = new ArrayList<SpanEvent>(size);
    for (int i = 0; i < size; i++) {
        SpanEvent spanEvent = new SpanEvent(span);
        spanEvent.markStartTime();
        Thread.sleep(1);
        spanEvent.markAfterTime();
        spanEventList.add(spanEvent);
    }
    return spanEventList;
}
Also used : ArrayList(java.util.ArrayList) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 2 with Span

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

the class SpanStreamSendDataPlanerTest method createSpanEventList.

private List<SpanEvent> createSpanEventList(int size) throws InterruptedException {
    Span span = new Span();
    List<SpanEvent> spanEventList = new ArrayList<SpanEvent>(size);
    for (int i = 0; i < size; i++) {
        SpanEvent spanEvent = new SpanEvent(span);
        spanEvent.markStartTime();
        Thread.sleep(1);
        spanEvent.markAfterTime();
        spanEventList.add(spanEvent);
    }
    return spanEventList;
}
Also used : ArrayList(java.util.ArrayList) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 3 with Span

use of com.navercorp.pinpoint.profiler.context.Span 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 4 with Span

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

the class SpanStreamSendDataPlanerTest method createSpan.

private Span createSpan(List<SpanEvent> spanEventList) {
    DefaultTraceId traceId = new DefaultTraceId("test", 0, 1);
    Span span = new Span();
    for (SpanEvent spanEvent : spanEventList) {
        span.addToSpanEventList(spanEvent);
    }
    span.setAgentId("agentId");
    span.recordTraceId(traceId);
    return span;
}
Also used : DefaultTraceId(com.navercorp.pinpoint.profiler.context.id.DefaultTraceId) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 5 with Span

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

the class SpanStreamUDPSenderTest method createSpan.

private Span createSpan(int spanEventSize) throws InterruptedException {
    List<SpanEvent> spanEventList = createSpanEventList(spanEventSize);
    Span span = new Span();
    List<TSpanEvent> tSpanEventList = new ArrayList<>();
    for (SpanEvent spanEvent : spanEventList) {
        tSpanEventList.add(spanEvent);
    }
    span.setSpanEventList(tSpanEventList);
    return span;
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) ArrayList(java.util.ArrayList) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) Span(com.navercorp.pinpoint.profiler.context.Span) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Aggregations

Span (com.navercorp.pinpoint.profiler.context.Span)34 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)18 Test (org.junit.Test)16 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)11 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)8 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)7 ArrayList (java.util.ArrayList)7 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)6 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)6 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)6 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)5 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)5 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)4 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)3 DefaultAsyncSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultAsyncSpanChunk)3 DefaultLocalAsyncId (com.navercorp.pinpoint.profiler.context.DefaultLocalAsyncId)3 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)2