Search in sources :

Example 21 with Span

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

the class SpanStreamUDPSenderTest method createSpanEventList.

private List<SpanEvent> createSpanEventList(int size) throws InterruptedException {
    // Span span = new SpanBo(new TSpan());
    Span span = new Span();
    List<SpanEvent> spanEventList = new ArrayList<>(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) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) Span(com.navercorp.pinpoint.profiler.context.Span)

Example 22 with Span

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

the class OrderedSpanRecorder method handleSpanEvent.

private void handleSpanEvent(SpanEvent event) {
    Span span = event.getSpan();
    int asyncId = event.isSetAsyncId() ? event.getAsyncId() : ASYNC_ID_NOT_SET;
    insertItem(new Item(event, span.getStartTime() + event.getStartElapsed(), span.getSpanId(), event.getSequence(), asyncId));
}
Also used : Span(com.navercorp.pinpoint.profiler.context.Span)

Example 23 with Span

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

the class PluginTestAgent method verifyIsLoggingTransactionInfo.

@Override
public void verifyIsLoggingTransactionInfo(LoggingInfo loggingInfo) {
    Object actual = popSpan();
    Span span = null;
    if (actual instanceof Span) {
        span = (Span) actual;
    } else if (actual instanceof SpanEvent) {
        span = ((SpanEvent) actual).getSpan();
    } else {
        throw new IllegalArgumentException("Unexpected type: " + getActual(actual));
    }
    if (span.getLoggingTransactionInfo() != loggingInfo.getCode()) {
        LoggingInfo loggingTransactionInfo = LoggingInfo.searchByCode(span.getLoggingTransactionInfo());
        if (loggingTransactionInfo != null) {
            throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but was [" + loggingTransactionInfo.getName() + "]. expected: " + loggingInfo.getName() + ", was: " + loggingTransactionInfo.getName());
        } else {
            throw new AssertionError("Expected a Span isLoggingTransactionInfo value with [" + loggingInfo.getName() + "] but loggingTransactionInfo value invalid.");
        }
    }
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) Span(com.navercorp.pinpoint.profiler.context.Span) LoggingInfo(com.navercorp.pinpoint.common.trace.LoggingInfo)

Example 24 with Span

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

the class OrderedSpanRecorderTest method createSpan.

private Span createSpan(long startTime, long spanId) {
    Span span = new Span();
    span.setStartTime(startTime);
    span.setSpanId(spanId);
    return span;
}
Also used : Span(com.navercorp.pinpoint.profiler.context.Span)

Example 25 with Span

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

the class SpanStreamSendDataSerializerTest 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) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) Span(com.navercorp.pinpoint.profiler.context.Span)

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