use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class TransactionIdFailedInterceptor method before.
@Override
public void before(Object target, Object[] args) {
AsyncContextAccessor accessor = ArrayArgumentUtils.getArgument(args, 2, AsyncContextAccessor.class);
AsyncContext asyncContext = accessor._$PINPOINT$_getAsyncContext();
final Trace trace = ((PinpointTraceAccessor) accessor)._$PINPOINT$_getPinpointTrace();
if (asyncContext == null || trace == null) {
return;
}
// set error message
String message = ((Function0) args[3]).apply().toString();
SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordException(new Throwable(message));
logger.debug("Record failed message : {}", message);
// close trace block and context
trace.traceBlockEnd();
trace.close();
asyncContext.close();
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class QueueingConsumerHandleInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (ArrayUtils.isEmpty(args)) {
return;
}
if (!(args[0] instanceof AsyncContextAccessor)) {
return;
}
if (!(result instanceof AsyncContextAccessor)) {
return;
}
AsyncContext asyncContext = ((AsyncContextAccessor) args[0])._$PINPOINT$_getAsyncContext();
((AsyncContextAccessor) result)._$PINPOINT$_setAsyncContext(asyncContext);
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class HttpClientImplDoRequestInterceptorV4 method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
if (!trace.canSampled()) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
recorder.recordServiceType(VertxConstants.VERTX_HTTP_CLIENT_INTERNAL);
final String hostAndPort = toHostAndPort(args);
if (hostAndPort != null) {
recorder.recordAttribute(AnnotationKey.HTTP_INTERNAL_DISPLAY, hostAndPort);
if (isDebug) {
logger.debug("Set hostAndPort {}", hostAndPort);
}
}
if (target instanceof AsyncContextAccessor) {
// make asynchronous trace-id
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class HttpClientRequestImplConstructorInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (ArrayUtils.getLength(args) < 1) {
return;
}
final Object arg = args[0];
final AsyncContext asyncContext = AsyncContextAccessorUtils.getAsyncContext(arg);
if (asyncContext != null) {
((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
}
if (arg instanceof SamplingRateFlag) {
final Boolean samplingRateFlag = ((SamplingRateFlag) (args[0]))._$PINPOINT$_getSamplingRateFlag();
((SamplingRateFlag) target)._$PINPOINT$_setSamplingRateFlag(samplingRateFlag);
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor in project pinpoint by naver.
the class HttpClientRequestImplDoHandleResponseInterceptor method doInBeforeTrace.
@Override
public void doInBeforeTrace(SpanEventRecorder recorder, AsyncContext asyncContext, Object target, Object[] args) {
if (!validate(args)) {
return;
}
final HttpClientResponseImpl response = (HttpClientResponseImpl) args[0];
if (statusCode) {
recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, response.statusCode());
}
((AsyncContextAccessor) response)._$PINPOINT$_setAsyncContext(asyncContext);
}
Aggregations