use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.
the class HystrixObservableTimeoutOperatorCallInterceptor method doInBeforeTrace.
@Override
protected void doInBeforeTrace(SpanEventRecorder recorder, Object target, Object[] args) {
if (target instanceof AsyncContextAccessor) {
AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
}
}
use of com.navercorp.pinpoint.bootstrap.context.AsyncContext in project pinpoint by naver.
the class DefaultClientExchangeHandlerImplStartMethodInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
final Trace trace = traceContext.currentRawTraceObject();
if (trace == null) {
return;
}
final HttpRequest httpRequest = getHttpRequest(target);
final NameIntValuePair<String> host = getHost(target);
final boolean sampling = trace.canSampled();
if (!sampling) {
if (httpRequest != null) {
this.requestTraceWriter.write(httpRequest);
}
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
// set remote trace
final TraceId nextId = trace.getTraceId().getNextTraceId();
recorder.recordNextSpanId(nextId.getSpanId());
recorder.recordServiceType(HttpClient4Constants.HTTP_CLIENT_4);
if (httpRequest != null) {
final String hostString = getHostString(host.getName(), host.getValue());
this.requestTraceWriter.write(httpRequest, nextId, hostString);
}
try {
if (isAsynchronousInvocation(target, args)) {
// set asynchronous trace
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
// check type isAsynchronousInvocation()
((AsyncContextAccessor) ((ResultFutureGetter) target)._$PINPOINT$_getResultFuture())._$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.context.AsyncContext 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.context.AsyncContext in project pinpoint by naver.
the class DeliveryConstructInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordServiceType(RabbitMQClientConstants.RABBITMQ_CLIENT_INTERNAL);
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
if (target instanceof AsyncContextAccessor) {
AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) target)._$PINPOINT$_setAsyncContext(asyncContext);
}
}
use of com.navercorp.pinpoint.bootstrap.context.AsyncContext 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);
}
Aggregations