@Around("anyControllerOrRestControllerWithPublicWebAsyncTaskMethod()") public Object wrapWebAsyncTaskWithCorrelationId(ProceedingJoinPoint pjp) throws Throwable { final WebAsyncTask<?> webAsyncTask = (WebAsyncTask<?>) pjp.proceed(); TraceContext currentSpan = this.tracing.currentTraceContext().get(); if (currentSpan == null) { return webAsyncTask; } try { if (log.isDebugEnabled()) { log.debug("Wrapping callable with span [" + currentSpan + "]"); } Field callableField = WebAsyncTask.class.getDeclaredField("callable"); callableField.setAccessible(true); callableField.set(webAsyncTask, new TraceCallable<>(this.tracing, this.spanNamer, webAsyncTask.getCallable())); } catch (NoSuchFieldException ex) { log.warn("Cannot wrap webAsyncTask's callable with TraceCallable", ex); } return webAsyncTask; }
interceptors.add(timeoutCallableInterceptor); final Callable<?> callable = webAsyncTask.getCallable(); final CallableInterceptorChain interceptorChain = new CallableInterceptorChain(interceptors);
interceptors.add(timeoutCallableInterceptor); final Callable<?> callable = webAsyncTask.getCallable(); final CallableInterceptorChain interceptorChain = new CallableInterceptorChain(interceptors);
@Around("anyControllerOrRestControllerWithPublicWebAsyncTaskMethod()") public Object tracePublicWebAsyncTaskMethods(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { final WebAsyncTask<?> webAsyncTask = (WebAsyncTask<?>) proceedingJoinPoint.proceed(); Field callableField = WebAsyncTask.class.getDeclaredField("callable"); callableField.setAccessible(true); // do not create span (there is always server span) just pass it to new thread. callableField .set(webAsyncTask, new TracedCallable<>(webAsyncTask.getCallable(), tracer)); return webAsyncTask; } }
@Around("anyControllerOrRestControllerWithPublicWebAsyncTaskMethod()") public Object wrapWebAsyncTaskWithCorrelationId(ProceedingJoinPoint pjp) throws Throwable { final WebAsyncTask<?> webAsyncTask = (WebAsyncTask<?>) pjp.proceed(); TraceContext currentSpan = this.tracing.currentTraceContext().get(); if (currentSpan == null) { return webAsyncTask; } try { if (log.isDebugEnabled()) { log.debug("Wrapping callable with span [" + currentSpan + "]"); } Field callableField = WebAsyncTask.class.getDeclaredField("callable"); callableField.setAccessible(true); callableField.set(webAsyncTask, new TraceCallable<>(this.tracing, this.spanNamer, webAsyncTask.getCallable())); } catch (NoSuchFieldException ex) { log.warn("Cannot wrap webAsyncTask's callable with TraceCallable", ex); } return webAsyncTask; }
interceptors.add(timeoutCallableInterceptor); final Callable<?> callable = webAsyncTask.getCallable(); final CallableInterceptorChain interceptorChain = new CallableInterceptorChain(interceptors);
interceptors.add(timeoutCallableInterceptor); final Callable<?> callable = webAsyncTask.getCallable(); final CallableInterceptorChain interceptorChain = new CallableInterceptorChain(interceptors);