@Override public void before(Object target, Object[] args) { if (isDebug) { logger.beforeInterceptor(target, args); } Trace trace = traceContext.currentRawTraceObject(); if (trace == null) { // create user include trace for standalone entry point. trace = createUserIncludeTrace(); if (trace == null) { return; } } // check user include trace. if (!isUserIncludeTrace(trace)) { return; } // entry scope(default & disable trace). entryUserIncludeTraceScope(trace); // check sampled. if (!trace.canSampled()) { // skip return; } trace.traceBlockBegin(); }
@Override public void before(Object target, Object[] args) { if (isDebug) { logger.beforeInterceptor(target, args); } final Trace trace = traceContext.currentRawTraceObject(); if (trace == null) { return; } if (!validate(target)) { return; } if (!trace.canSampled()) { return; } SpanEventRecorder recorder = trace.traceBlockBegin(); try { final TraceId nextId = trace.getTraceId().getNextTraceId(); recorder.recordNextSpanId(nextId.getSpanId()); recorder.recordServiceType(OK_HTTP_CLIENT); InterceptorGroupInvocation invocation = interceptorGroup.getCurrentInvocation(); if (invocation != null) { invocation.getOrCreateAttachment( new AttachmentFactory() { @Override public Object createAttachment() { return nextId; } }); } } catch (Throwable t) { logger.warn("Failed to BEFORE process. {}", t.getMessage(), t); } }