Search in sources :

Example 36 with TraceRoot

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

the class SpanThriftMessageConverter method buildTSpan.

@VisibleForTesting
TSpan buildTSpan(Span span) {
    final TSpan tSpan = new TSpan();
    // tSpan.setVersion(span.getVersion());
    tSpan.setApplicationName(applicationName);
    tSpan.setAgentId(agentId);
    tSpan.setAgentStartTime(agentStartTime);
    tSpan.setApplicationServiceType(applicationServiceType);
    final TraceRoot traceRoot = span.getTraceRoot();
    final TraceId traceId = traceRoot.getTraceId();
    final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
    tSpan.setTransactionId(transactionId);
    tSpan.setSpanId(traceId.getSpanId());
    tSpan.setParentSpanId(traceId.getParentSpanId());
    tSpan.setStartTime(span.getStartTime());
    tSpan.setElapsed(span.getElapsedTime());
    tSpan.setServiceType(span.getServiceType());
    tSpan.setRemoteAddr(span.getRemoteAddr());
    final Shared shared = traceRoot.getShared();
    tSpan.setRpc(shared.getRpcName());
    tSpan.setEndPoint(shared.getEndPoint());
    tSpan.setFlag(traceId.getFlags());
    tSpan.setErr(shared.getErrorCode());
    tSpan.setParentApplicationName(span.getParentApplicationName());
    tSpan.setParentApplicationType(span.getParentApplicationType());
    tSpan.setAcceptorHost(span.getAcceptorHost());
    tSpan.setApiId(span.getApiId());
    final IntStringValue exceptionInfo = span.getExceptionInfo();
    if (exceptionInfo != null) {
        TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);
        tSpan.setExceptionInfo(tIntStringValue);
    }
    tSpan.setLoggingTransactionInfo(shared.getLoggingInfo());
    final List<Annotation<?>> annotations = span.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);
        tSpan.setAnnotations(tAnnotations);
    }
    spanPostProcessor.preProcess(span, tSpan);
    final List<SpanEvent> spanEventList = span.getSpanEventList();
    if (CollectionUtils.hasLength(spanEventList)) {
        final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
        tSpan.setSpanEventList(tSpanEvents);
    }
    spanPostProcessor.postProcess(span, tSpan);
    return tSpan;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) Shared(com.navercorp.pinpoint.profiler.context.id.Shared) ByteBuffer(java.nio.ByteBuffer) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Aggregations

TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)36 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)17 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)16 Test (org.junit.Test)13 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)12 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)10 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)9 DefaultSpanChunk (com.navercorp.pinpoint.profiler.context.DefaultSpanChunk)7 Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)7 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)6 Span (com.navercorp.pinpoint.profiler.context.Span)6 SpanChunk (com.navercorp.pinpoint.profiler.context.SpanChunk)6 WrappedSpanEventRecorder (com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder)6 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)6 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)5 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)5 ByteBuffer (java.nio.ByteBuffer)5 TraceSampler (com.navercorp.pinpoint.bootstrap.sampler.TraceSampler)4 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)4 ActiveTraceHandle (com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle)4