Search in sources :

Example 51 with AsyncContext

use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.

the class HttpClientHandlerConstructorInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) throws Exception {
    recorder.recordApi(methodDescriptor);
    recorder.recordException(throwable);
    recorder.recordServiceType(ReactorNettyConstants.REACTOR_NETTY_CLIENT_INTERNAL);
    if (throwable == null && target instanceof AsyncContextAccessor) {
        final AsyncContext asyncContext = recorder.recordNextAsyncContext();
        ((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 52 with AsyncContext

use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.

the class HttpClientOperationsSendInterceptor method getAsyncContext.

// BEFORE
@Override
public AsyncContext getAsyncContext(Object target, Object[] args) {
    if (Boolean.FALSE == validate(target)) {
        return null;
    }
    final HttpClientRequest request = (HttpClientRequest) target;
    final AsyncContext asyncContext = AsyncContextAccessorUtils.getAsyncContext(target);
    if (asyncContext == null) {
        // Set sampling rate to false
        this.requestTraceWriter.write(request);
        return null;
    }
    return asyncContext;
}
Also used : HttpClientRequest(reactor.netty.http.client.HttpClientRequest) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 53 with AsyncContext

use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.

the class SchedulerAndWorkerScheduleMethodInterceptor method doInAfterTrace.

// Disposable schedule(Runnable task);
// Disposable schedule(Runnable task, long delay, TimeUnit unit)
// Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit)
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    recorder.recordApi(methodDescriptor);
    recorder.recordException(throwable);
    recorder.recordServiceType(ReactorConstants.REACTOR_NETTY);
    if (isAsynchronousInvocation(target, args, result, throwable)) {
        // Trace to Disposable object
        final AsyncContext asyncContext = recorder.recordNextAsyncContext();
        ((AsyncContextAccessor) (result))._$PINPOINT$_setAsyncContext(asyncContext);
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 54 with AsyncContext

use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.

the class LettuceMethodInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    final String endPoint = toEndPoint(target);
    recorder.recordApi(getMethodDescriptor());
    recorder.recordEndPoint(endPoint != null ? endPoint : "Unknown");
    recorder.recordDestinationId(LettuceConstants.REDIS_LETTUCE.getName());
    recorder.recordServiceType(LettuceConstants.REDIS_LETTUCE);
    recorder.recordException(throwable);
    if (result instanceof AsyncContextAccessor) {
        if (AsyncContextAccessorUtils.getAsyncContext(result) == null) {
            // Avoid duplicate async context
            final AsyncContext asyncContext = recorder.recordNextAsyncContext();
            ((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
        }
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Example 55 with AsyncContext

use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.

the class HttpTcpClientConnectInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) throws Exception {
    recorder.recordApi(methodDescriptor);
    recorder.recordException(throwable);
    recorder.recordServiceType(ReactorNettyConstants.REACTOR_NETTY_CLIENT_INTERNAL);
    if (result instanceof AsyncContextAccessor) {
        // Set MonoHttpConnect
        final AsyncContext asyncContext = recorder.recordNextAsyncContext();
        ((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
    }
}
Also used : AsyncContextAccessor(com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor) AsyncContext(com.navercorp.pinpoint.bootstrap.context.AsyncContext)

Aggregations

AsyncContext (com.navercorp.pinpoint.bootstrap.context.AsyncContext)68 AsyncContextAccessor (com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor)44 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)31 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)28 Test (org.junit.Test)7 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)2 InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)2 NormalizedBson (com.navercorp.pinpoint.plugin.mongo.NormalizedBson)2 HttpServerResponse (io.vertx.core.http.HttpServerResponse)2 Method (java.lang.reflect.Method)2 Continuation (kotlin.coroutines.Continuation)2 RequestContextImpl (akka.http.scaladsl.server.RequestContextImpl)1 AsyncStateSupport (com.navercorp.pinpoint.bootstrap.context.AsyncStateSupport)1 SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)1 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)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 TraceFutureFlagAccessor (com.navercorp.pinpoint.plugin.resttemplate.field.accessor.TraceFutureFlagAccessor)1