Search in sources :

Example 1 with AsyncId

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

the class GrpcSpanMessageConverter method buildPSpanEvent.

@VisibleForTesting
public PSpanEvent.Builder buildPSpanEvent(SpanEvent spanEvent) {
    final PSpanEvent.Builder pSpanEvent = getSpanEventBuilder();
    // tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());
    if (spanEvent.getElapsedTime() != 0) {
        pSpanEvent.setEndElapsed(spanEvent.getElapsedTime());
    }
    pSpanEvent.setSequence(spanEvent.getSequence());
    // tSpanEvent.setRpc(spanEvent.getRpc());
    pSpanEvent.setServiceType(spanEvent.getServiceType());
    // tSpanEvent.setAnnotations();
    if (spanEvent.getDepth() != -1) {
        pSpanEvent.setDepth(spanEvent.getDepth());
    }
    pSpanEvent.setApiId(spanEvent.getApiId());
    final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        PIntStringValue pIntStringValue = buildPIntStringValue(exceptionInfo);
        pSpanEvent.setExceptionInfo(pIntStringValue);
    }
    final PNextEvent nextEvent = buildNextEvent(spanEvent);
    if (nextEvent != null) {
        pSpanEvent.setNextEvent(nextEvent);
    }
    final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();
    if (asyncIdObject != null) {
        pSpanEvent.setAsyncEvent(asyncIdObject.getAsyncId());
    }
    final List<Annotation<?>> annotations = spanEvent.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<PAnnotation> pAnnotations = buildPAnnotation(annotations);
        pSpanEvent.addAllAnnotation(pAnnotations);
    }
    return pSpanEvent;
}
Also used : PNextEvent(com.navercorp.pinpoint.grpc.trace.PNextEvent) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) PIntStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringValue) PLocalAsyncId(com.navercorp.pinpoint.grpc.trace.PLocalAsyncId) AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) PSpanEvent(com.navercorp.pinpoint.grpc.trace.PSpanEvent) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) PAnnotation(com.navercorp.pinpoint.grpc.trace.PAnnotation) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 2 with AsyncId

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

the class SpanThriftMessageConverter method buildTSpanEvent.

@VisibleForTesting
TSpanEvent buildTSpanEvent(SpanEvent spanEvent) {
    final TSpanEvent tSpanEvent = new TSpanEvent();
    // tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());
    if (spanEvent.getElapsedTime() != 0) {
        tSpanEvent.setEndElapsed(spanEvent.getElapsedTime());
    }
    tSpanEvent.setSequence((short) spanEvent.getSequence());
    // tSpanEvent.setRpc(spanEvent.getRpc());
    tSpanEvent.setServiceType(spanEvent.getServiceType());
    tSpanEvent.setEndPoint(spanEvent.getEndPoint());
    // tSpanEvent.setAnnotations();
    if (spanEvent.getDepth() != -1) {
        tSpanEvent.setDepth(spanEvent.getDepth());
    }
    if (spanEvent.getNextSpanId() != -1) {
        tSpanEvent.setNextSpanId(spanEvent.getNextSpanId());
    }
    tSpanEvent.setDestinationId(spanEvent.getDestinationId());
    tSpanEvent.setApiId(spanEvent.getApiId());
    final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();
    if (exceptionInfo != null) {
        TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);
        tSpanEvent.setExceptionInfo(tIntStringValue);
    }
    final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();
    if (asyncIdObject != null) {
        tSpanEvent.setNextAsyncId(asyncIdObject.getAsyncId());
    }
    final List<Annotation<?>> annotations = spanEvent.getAnnotations();
    if (CollectionUtils.hasLength(annotations)) {
        final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);
        tSpanEvent.setAnnotations(tAnnotations);
    }
    return tSpanEvent;
}
Also used : TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) IntStringValue(com.navercorp.pinpoint.common.util.IntStringValue) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue) TLocalAsyncId(com.navercorp.pinpoint.thrift.dto.TLocalAsyncId) AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) LocalAsyncId(com.navercorp.pinpoint.profiler.context.LocalAsyncId) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) Annotation(com.navercorp.pinpoint.profiler.context.Annotation) TAnnotation(com.navercorp.pinpoint.thrift.dto.TAnnotation) VisibleForTesting(com.navercorp.pinpoint.common.annotations.VisibleForTesting)

Example 3 with AsyncId

use of com.navercorp.pinpoint.profiler.context.AsyncId 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 4 with AsyncId

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

the class WrappedSpanEventRecorder method recordNextAsyncContext.

@Override
public AsyncContext recordNextAsyncContext() {
    final TraceRoot traceRoot = this.traceRoot;
    final AsyncId asyncIdObject = getNextAsyncId();
    // sequence or stack overflow
    final boolean canSampled = isOverflowState();
    return asyncContextFactory.newAsyncContext(traceRoot, asyncIdObject, canSampled);
}
Also used : AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId) TraceRoot(com.navercorp.pinpoint.profiler.context.id.TraceRoot)

Example 5 with AsyncId

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

the class WrappedSpanEventRecorder method getNextAsyncId.

protected AsyncId getNextAsyncId() {
    AsyncId nextAsyncId = spanEvent.getAsyncIdObject();
    if (nextAsyncId == null) {
        nextAsyncId = asyncContextFactory.newAsyncId();
        spanEvent.setAsyncIdObject(nextAsyncId);
    }
    return nextAsyncId;
}
Also used : AsyncId(com.navercorp.pinpoint.profiler.context.AsyncId)

Aggregations

AsyncId (com.navercorp.pinpoint.profiler.context.AsyncId)5 VisibleForTesting (com.navercorp.pinpoint.common.annotations.VisibleForTesting)2 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)2 Annotation (com.navercorp.pinpoint.profiler.context.Annotation)2 LocalAsyncId (com.navercorp.pinpoint.profiler.context.LocalAsyncId)2 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)2 AsyncContext (com.navercorp.pinpoint.bootstrap.context.AsyncContext)1 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)1 PAnnotation (com.navercorp.pinpoint.grpc.trace.PAnnotation)1 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)1 PLocalAsyncId (com.navercorp.pinpoint.grpc.trace.PLocalAsyncId)1 PNextEvent (com.navercorp.pinpoint.grpc.trace.PNextEvent)1 PSpanEvent (com.navercorp.pinpoint.grpc.trace.PSpanEvent)1 TAnnotation (com.navercorp.pinpoint.thrift.dto.TAnnotation)1 TIntStringValue (com.navercorp.pinpoint.thrift.dto.TIntStringValue)1 TLocalAsyncId (com.navercorp.pinpoint.thrift.dto.TLocalAsyncId)1 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)1