use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class DispatcherEnqueueMethodInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
AsyncContextAccessor accessor = getAsyncContextAccessor(args);
if (accessor == null) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
try {
// set asynchronous trace
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
// AsyncTraceIdAccessor typeCheck validate();
accessor._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set AsyncContext {}", asyncContext);
}
} catch (Throwable t) {
logger.warn("Failed to before process. {}", t.getMessage(), t);
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class BodyInserterRequestBuilderWriteToInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
if (!validate(args)) {
return;
}
final ClientHttpRequest request = (ClientHttpRequest) args[0];
final ClientRequestWrapper clientRequestWrapper = new WebClientRequestWrapper(request);
this.clientRequestRecorder.record(recorder, clientRequestWrapper, throwable);
this.cookieRecorder.record(recorder, request, throwable);
if (isAsync(result)) {
// make asynchronous trace-id
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set closeable-AsyncContext {}", asyncContext);
}
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class DefaultWebClientExchangeMethodInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
recorder.recordServiceType(SpringWebFluxConstants.SPRING_WEBFLUX);
if (isAsync(result)) {
// make asynchronous trace-id
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set closeable-AsyncContext {}", asyncContext);
}
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class DispatchHandlerInvokeHandlerMethodInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordServiceType(SpringWebFluxConstants.SPRING_WEBFLUX);
recorder.recordException(throwable);
if (Boolean.FALSE == validate(args)) {
return;
}
final AsyncContext publisherAsyncContext = AsyncContextAccessorUtils.getAsyncContext(args, 0);
if (publisherAsyncContext != null) {
// Set AsyncContext to CoreSubscriber
if (result instanceof AsyncContextAccessor) {
((AsyncContextAccessor) (result))._$PINPOINT$_setAsyncContext(publisherAsyncContext);
if (isDebug) {
logger.debug("Set AsyncContext result={}", result);
}
}
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class DispatchHandlerHandleMethodInterceptor method doInBeforeTrace.
@Override
protected void doInBeforeTrace(SpanEventRecorder recorder, Object target, Object[] args) {
if (isAsync(args)) {
// make asynchronous trace-id
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) args[0])._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set AsyncContext {}", asyncContext);
}
}
}
Aggregations