Search in sources :

Example 11 with AsyncContextAccessor

use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.

the class WorkerScheduleInterceptor method doInBeforeTrace.

@Override
protected void doInBeforeTrace(SpanEventRecorder recorder, Object target, Object[] args) {
    logBeforeInterceptor0(target, args);
    if (args != null && args.length > 0) {
        if (args[0] instanceof AsyncContextAccessor) {
            AsyncContext asyncContext = recorder.recordNextAsyncContext();
            ((AsyncContextAccessor) args[0])._$PINPOINT$_setAsyncContext(asyncContext);
        }
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 12 with AsyncContextAccessor

use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.

the class ListenerConstructorInterceptor method doInAfterTrace.

@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    if (target instanceof AsyncContextAccessor) {
        // set asynchronous trace
        final AsyncContext asyncContext = recorder.recordNextAsyncContext();
        ((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
        if (isDebug) {
            logger.debug("Set AsyncContext {}", asyncContext);
        }
    }
    recorder.recordApi(LISTENER_RESULT_DESCRIPTOR);
    recorder.recordException(throwable);
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 13 with AsyncContextAccessor

use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.

the class CopyAsyncContextInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args);
    }
    if (ArrayUtils.getLength(args) == 2) {
        AsyncContext asyncContext = getAsyncContext(args[0]);
        if (result instanceof AsyncContextAccessor) {
            logger.info("set AsyncContext:{}", asyncContext);
            ((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
        }
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 14 with AsyncContextAccessor

use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.

the class ServerStreamCreatedInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }
    if (traceContext.currentTraceObject() != null) {
        return;
    }
    GrpcServerStreamRequest request = GrpcServerStreamRequest.create(args);
    if (request == null) {
        return;
    }
    final Trace trace = createTrace(request);
    if (trace == null || !trace.canSampled()) {
        return;
    }
    final SpanEventRecorder recorder = trace.traceBlockBegin();
    recorder.recordServiceType(GrpcConstants.SERVER_SERVICE_TYPE_INTERNAL);
    final AsyncContext asyncContext = recorder.recordNextAsyncContext(true);
    if (args[0] instanceof AsyncContextAccessor) {
        ((AsyncContextAccessor) args[0])._$PINPOINT$_setAsyncContext(asyncContext);
        logger.debug("Set closeable-AsyncContext {}", asyncContext);
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 15 with AsyncContextAccessor

use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.

the class HttpEncoderInterceptor method validate.

private boolean validate(Object[] args) {
    if (ArrayUtils.getLength(args) != 3) {
        return false;
    }
    if (!(args[0] instanceof ChannelHandlerContext)) {
        return false;
    }
    ChannelHandlerContext channelHandlerContext = (ChannelHandlerContext) args[0];
    Channel channel = channelHandlerContext.channel();
    if (channel == null) {
        return false;
    }
    if (!(args[1] instanceof HttpMessage)) {
        return false;
    }
    HttpMessage httpMessage = (HttpMessage) args[1];
    if (httpMessage.headers() == null) {
        return false;
    }
    if (!(args[1] instanceof AsyncContextAccessor)) {
        return false;
    }
    if (!(args[1] instanceof AsyncStartFlagFieldAccessor)) {
        return false;
    }
    return true;
}
Also used : Channel(io.netty.channel.Channel) AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) HttpMessage(io.netty.handler.codec.http.HttpMessage) AsyncStartFlagFieldAccessor(com.navercorp.pinpoint.plugin.netty.field.accessor.AsyncStartFlagFieldAccessor)

Aggregations

AsyncContextAccessor (com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor)54 AsyncContext (com.navercorp.pinpoint.bootstrap.context.AsyncContext)44 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)16 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)16 NormalizedBson (com.navercorp.pinpoint.plugin.mongo.NormalizedBson)2 PinpointTraceAccessor (com.navercorp.pinpoint.plugin.openwhisk.accessor.PinpointTraceAccessor)2 Continuation (kotlin.coroutines.Continuation)2 RequestContextImpl (akka.http.scaladsl.server.RequestContextImpl)1 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)1 AsyncStateSupport (com.navercorp.pinpoint.bootstrap.context.AsyncStateSupport)1 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1 InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)1 ClientRequestWrapper (com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper)1 OperationAccessor (com.navercorp.pinpoint.plugin.arcus.OperationAccessor)1 ServiceCodeAccessor (com.navercorp.pinpoint.plugin.arcus.ServiceCodeAccessor)1 AsyncStartFlagFieldAccessor (com.navercorp.pinpoint.plugin.netty.field.accessor.AsyncStartFlagFieldAccessor)1 LogMarkerMethodDescriptor (com.navercorp.pinpoint.plugin.openwhisk.descriptor.LogMarkerMethodDescriptor)1 TraceFutureFlagAccessor (com.navercorp.pinpoint.plugin.resttemplate.field.accessor.TraceFutureFlagAccessor)1 SamplingRateFlag (com.navercorp.pinpoint.plugin.vertx.SamplingRateFlag)1 Channel (io.netty.channel.Channel)1