Search in sources :

Example 16 with TraceRoot

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

the class SpanThriftMessageConverter method buildTSpanChunk.

@VisibleForTesting
TSpanChunk buildTSpanChunk(SpanChunk spanChunk) {
    final TSpanChunk tSpanChunk = new TSpanChunk();
    tSpanChunk.setApplicationName(applicationName);
    tSpanChunk.setAgentId(agentId);
    tSpanChunk.setAgentStartTime(agentStartTime);
    tSpanChunk.setApplicationServiceType(applicationServiceType);
    final TraceRoot traceRoot = spanChunk.getTraceRoot();
    final TraceId traceId = traceRoot.getTraceId();
    final ByteBuffer transactionId = transactionIdEncoder.encodeTransactionId(traceId);
    tSpanChunk.setTransactionId(transactionId);
    tSpanChunk.setSpanId(traceId.getSpanId());
    final Shared shared = traceRoot.getShared();
    tSpanChunk.setEndPoint(shared.getEndPoint());
    if (spanChunk instanceof AsyncSpanChunk) {
        final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
        final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
        final TLocalAsyncId tLocalAsyncId = new TLocalAsyncId(localAsyncId.getAsyncId(), localAsyncId.getSequence());
        tSpanChunk.setLocalAsyncId(tLocalAsyncId);
    }
    spanPostProcessor.preProcess(spanChunk, tSpanChunk);
    final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
    if (CollectionUtils.hasLength(spanEventList)) {
        final List<TSpanEvent> tSpanEvents = buildTSpanEventList(spanEventList);
        tSpanChunk.setSpanEventList(tSpanEvents);
    }
    spanPostProcessor.postProcess(spanChunk, tSpanChunk);
    return tSpanChunk;
}
Also used : TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) AsyncSpanChunk(com.navercorp.pinpoint.profiler.context.AsyncSpanChunk) TLocalAsyncId(com.navercorp.pinpoint.thrift.dto.TLocalAsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) TLocalAsyncId(com.navercorp.pinpoint.thrift.dto.TLocalAsyncId) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) Shared(com.navercorp.pinpoint.profiler.context.id.Shared) ByteBuffer(java.nio.ByteBuffer) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 17 with TraceRoot

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

the class WrappedAsyncSpanEventRecorder method recordNextAsyncContext.

@Override
public AsyncContext recordNextAsyncContext(boolean asyncStateSupport) {
    if (asyncStateSupport) {
        final TraceRoot traceRoot = this.traceRoot;
        final AsyncId asyncIdObject = getNextAsyncId();
        final boolean isDisabled = isOverflowState();
        final AsyncState asyncState = this.asyncState;
        asyncState.setup();
        final AsyncContext asyncContext = asyncContextFactory.newAsyncContext(traceRoot, asyncIdObject, isDisabled, asyncState);
        return asyncContext;
    }
    return recordNextAsyncContext();
}
Also used : AsyncState(com.navercorp.pinpoint.bootstrap.context.AsyncState) AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 18 with TraceRoot

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

the class DefaultSpanRecorder method maskErrorCode.

@Override
void maskErrorCode(final int errorCode) {
    final TraceRoot traceRoot = span.getTraceRoot();
    traceRoot.getShared().maskErrorCode(errorCode);
}
Also used : TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 19 with TraceRoot

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

the class SpanProcessorV1 method postProcess.

@Override
public void postProcess(Span span, TSpan tSpan) {
    final TraceRoot traceRoot = span.getTraceRoot();
    final long keyTime = traceRoot.getTraceStartTime();
    List<SpanEvent> spanEventList = span.getSpanEventList();
    if (spanEventList == null) {
        spanEventList = Collections.emptyList();
    }
    List<TSpanEvent> tSpanEventList = tSpan.getSpanEventList();
    if (tSpanEventList == null) {
        tSpanEventList = Collections.emptyList();
    }
    postEventProcess(spanEventList, tSpanEventList, keyTime);
}
Also used : SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Example 20 with TraceRoot

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

the class ActiveThreadServiceTest method createTraceRoot.

private TraceRoot createTraceRoot(long executionTime) {
    TraceRoot traceRoot = Mockito.mock(TraceRoot.class);
    Mockito.when(traceRoot.getTraceStartTime()).thenReturn(System.currentTimeMillis() - executionTime);
    Mockito.when(traceRoot.getLocalTransactionId()).thenReturn(nextLocalTransactionId());
    return traceRoot;
}
Also used : TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

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