Search in sources :

Example 1 with SpanEvent

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

the class OrderedSpanRecorderTest method createAsyncSpanEvent.

private SpanEvent createAsyncSpanEvent(Span associatedSpan, int startElapsed, short sequence, int asyncId) {
    if (startElapsed < 0) {
        throw new IllegalArgumentException("startElapsed cannot be less than 0");
    }
    if (sequence < 0) {
        throw new IllegalArgumentException("sequence cannot be less than 0");
    }
    if (asyncId < 0) {
        throw new IllegalArgumentException("asyncId cannot be less than 0");
    }
    SpanEvent event = new SpanEvent(associatedSpan);
    event.setStartElapsed(startElapsed);
    event.setSequence(sequence);
    if (asyncId != UNSET_ASYNC_ID) {
        event.setAsyncId(asyncId);
    }
    return event;
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent)

Example 2 with SpanEvent

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

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

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

use of com.navercorp.pinpoint.profiler.context.SpanEvent 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)

Aggregations

SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)49 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)23 Test (org.junit.Test)20 Span (com.navercorp.pinpoint.profiler.context.Span)18 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)10 ArrayList (java.util.ArrayList)10 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)9 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)7 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)6 BasePinpointTest (com.navercorp.pinpoint.test.junit4.BasePinpointTest)6 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)5 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)5 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)5 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)4 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)4 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 PSpan (com.navercorp.pinpoint.grpc.trace.PSpan)3 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)3 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)3 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)3