use of kotlin.coroutines.Continuation 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 kotlin.coroutines.Continuation in project pinpoint by naver.
the class ScheduleResumeInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, descriptor.getClassName(), descriptor.getMethodName(), descriptor.getParameterDescriptor(), args, result, throwable);
}
final Continuation continuation = getContinuation(args);
if (continuation == null) {
return;
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(descriptor);
recorder.recordServiceType(serviceType);
recorder.recordException(throwable);
} finally {
trace.traceBlockEnd();
}
}
use of kotlin.coroutines.Continuation in project pinpoint by naver.
the class ResumeWithInterceptor method getAsyncContext.
private AsyncContext getAsyncContext(Object object) {
if (object instanceof Continuation) {
CoroutineContext context = ((Continuation<?>) object).getContext();
if (context instanceof AsyncContextAccessor) {
AsyncContextAccessor accessor = (AsyncContextAccessor) context;
AsyncContext asyncContext = accessor._$PINPOINT$_getAsyncContext();
return asyncContext;
}
}
return null;
}
Aggregations