Search in sources :

Example 1 with PLocalAsyncId

use of com.navercorp.pinpoint.grpc.trace.PLocalAsyncId in project pinpoint by naver.

the class GrpcSpanMessageConverter method buildPSpanChunk.

@VisibleForTesting
PSpanChunk buildPSpanChunk(SpanChunk spanChunk) {
    final PSpanChunk.Builder pSpanChunk = PSpanChunk.newBuilder();
    pSpanChunk.setVersion(SpanVersion.TRACE_V2);
    // tSpanChunk.setApplicationName(applicationName);
    // tSpanChunk.setAgentId(agentId);
    // tSpanChunk.setAgentStartTime(agentStartTime);
    pSpanChunk.setApplicationServiceType(applicationServiceType);
    final TraceRoot traceRoot = spanChunk.getTraceRoot();
    final TraceId traceId = traceRoot.getTraceId();
    final PTransactionId transactionId = newTransactionId(traceId);
    pSpanChunk.setTransactionId(transactionId);
    pSpanChunk.setSpanId(traceId.getSpanId());
    final Shared shared = traceRoot.getShared();
    final String endPoint = shared.getEndPoint();
    if (endPoint != null) {
        pSpanChunk.setEndPoint(endPoint);
    }
    if (spanChunk instanceof AsyncSpanChunk) {
        final AsyncSpanChunk asyncSpanChunk = (AsyncSpanChunk) spanChunk;
        final LocalAsyncId localAsyncId = asyncSpanChunk.getLocalAsyncId();
        final PLocalAsyncId.Builder pAsyncIdBuilder = PLocalAsyncId.newBuilder();
        pAsyncIdBuilder.setAsyncId(localAsyncId.getAsyncId());
        pAsyncIdBuilder.setSequence(localAsyncId.getSequence());
        final PLocalAsyncId pLocalAsyncId = pAsyncIdBuilder.build();
        pSpanChunk.setLocalAsyncId(pLocalAsyncId);
    }
    this.spanProcessor.preProcess(spanChunk, pSpanChunk);
    final List<SpanEvent> spanEventList = spanChunk.getSpanEventList();
    if (CollectionUtils.hasLength(spanEventList)) {
        final List<PSpanEvent> pSpanEvents = buildPSpanEventList(spanEventList);
        pSpanChunk.addAllSpanEvent(pSpanEvents);
    }
    this.spanProcessor.postProcess(spanChunk, pSpanChunk);
    return pSpanChunk.build();
}
Also used : PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) PSpanChunk(com.navercorp.pinpoint.grpc.trace.PSpanChunk) PTransactionId(com.navercorp.pinpoint.grpc.trace.PTransactionId) Shared(com.navercorp.pinpoint.profiler.context.id.Shared) AsyncSpanChunk(com.navercorp.pinpoint.profiler.context.AsyncSpanChunk) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) SpanEvent(com.navercorp.pinpoint.profiler.context.SpanEvent) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 2 with PLocalAsyncId

use of com.navercorp.pinpoint.grpc.trace.PLocalAsyncId in project pinpoint by naver.

the class GrpcSpanBinder method bindSpanChunkBo.

public SpanChunkBo bindSpanChunkBo(PSpanChunk pSpanChunk, Header header) {
    checkVersion(pSpanChunk.getVersion());
    final SpanChunkBo spanChunkBo = newSpanChunkBo(pSpanChunk, header);
    if (pSpanChunk.hasLocalAsyncId()) {
        final PLocalAsyncId pLocalAsyncId = pSpanChunk.getLocalAsyncId();
        LocalAsyncIdBo localAsyncIdBo = new LocalAsyncIdBo(pLocalAsyncId.getAsyncId(), pLocalAsyncId.getSequence());
        spanChunkBo.setLocalAsyncId(localAsyncIdBo);
    }
    return spanChunkBo;
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) LocalAsyncIdBo(com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)

Aggregations

PLocalAsyncId (com.navercorp.pinpoint.grpc.trace.PLocalAsyncId)2 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)1 LocalAsyncIdBo (com.navercorp.pinpoint.common.server.bo.LocalAsyncIdBo)1 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)1 PSpanChunk (com.navercorp.pinpoint.grpc.trace.PSpanChunk)1 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)1 PTransactionId (com.navercorp.pinpoint.grpc.trace.PTransactionId)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