use of com.navercorp.pinpoint.bootstrap.context.AsyncContext 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);
}
}
use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.
the class MongoCUDSessionInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (collectJson) {
final boolean success = InterceptorUtils.isSuccess(throwable);
if (success) {
if (args != null) {
NormalizedBson parsedBson = MongoUtil.parseBson(args, traceBsonBindValue);
MongoUtil.recordParsedBson(recorder, parsedBson);
}
}
}
recorder.recordException(throwable);
if (isAsynchronousInvocation(target, args, result, throwable)) {
// Trace to Disposable object
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) (result))._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set AsyncContext {}, result={}", asyncContext, result);
}
}
}
use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.
the class ScheduleResumeInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, descriptor.getClassName(), descriptor.getMethodName(), descriptor.getParameterDescriptor(), args);
}
final Continuation continuation = getContinuation(args);
if (continuation == null) {
return;
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
final AsyncContextAccessor asyncContextAccessor = getAsyncContextAccessor(continuation);
if (asyncContextAccessor != null) {
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
asyncContextAccessor._$PINPOINT$_setAsyncContext(asyncContext);
}
}
use of com.navercorp.pinpoint.bootstrap.context.AsyncContext 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.context.AsyncContext 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);
}
}
}
Aggregations