use of com.navercorp.pinpoint.bootstrap.async.AsyncTraceIdAccessor in project pinpoint by naver.
the class ServerConnectionHandleRequestInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
if (traceContext.currentRawTraceObject() != null) {
// duplicate trace.
return;
}
try {
if (!validate(args)) {
// invalid args.
return;
}
final HttpServerRequestImpl request = (HttpServerRequestImpl) args[0];
final HttpServerResponseImpl response = (HttpServerResponseImpl) args[1];
// create trace for standalone entry point.
final Trace trace = createTrace(request);
if (trace == null) {
return;
}
entryScope(trace);
if (!trace.canSampled()) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
recorder.recordServiceType(VertxConstants.VERTX_HTTP_SERVER_INTERNAL);
// make asynchronous trace-id
final AsyncTraceId asyncTraceId = trace.getAsyncTraceId(true);
recorder.recordNextAsyncId(asyncTraceId.getAsyncId());
((AsyncTraceIdAccessor) request)._$PINPOINT$_setAsyncTraceId(asyncTraceId);
((AsyncTraceIdAccessor) response)._$PINPOINT$_setAsyncTraceId(asyncTraceId);
if (isDebug) {
logger.debug("Set closeable-asyncTraceId metadata {}", asyncTraceId);
}
} catch (Throwable t) {
if (logger.isWarnEnabled()) {
logger.warn("BEFORE. Caused:{}", t.getMessage(), t);
}
}
}
use of com.navercorp.pinpoint.bootstrap.async.AsyncTraceIdAccessor in project pinpoint by naver.
the class VertxImplExecuteBlockingInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
if (validate(args, 0) || validate(args, 2)) {
// make asynchronous trace-id
final AsyncTraceId asyncTraceId = trace.getAsyncTraceId();
recorder.recordNextAsyncId(asyncTraceId.getAsyncId());
if (validate(args, 0)) {
// args 0 'io.vertx.core.Handler'
((AsyncTraceIdAccessor) args[0])._$PINPOINT$_setAsyncTraceId(asyncTraceId);
}
if (validate(args, 2)) {
// args 2 'io.vertx.core.Handler'
((AsyncTraceIdAccessor) args[2])._$PINPOINT$_setAsyncTraceId(asyncTraceId);
}
if (isDebug) {
logger.debug("Set asyncTraceId metadata {}", asyncTraceId);
}
}
}
Aggregations