Search in sources :

Example 1 with TLocalAsyncId

use of com.navercorp.pinpoint.thrift.dto.TLocalAsyncId 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)

Aggregations

TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)1 AsyncSpanChunk (com.navercorp.pinpoint.profiler.context.AsyncSpanChunk)1 LocalAsyncId (com.navercorp.pinpoint.profiler.context.LocalAsyncId)1 SpanEvent (com.navercorp.pinpoint.profiler.context.SpanEvent)1 Shared (com.navercorp.pinpoint.profiler.context.id.Shared)1 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)1 TLocalAsyncId (com.navercorp.pinpoint.thrift.dto.TLocalAsyncId)1 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)1 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)1 ByteBuffer (java.nio.ByteBuffer)1