Open
Description
TracedThreadPoolTaskExecutor tracedExecutor = new TracedThreadPoolTaskExecutor(myExecutor, GlobalTracer.get());
try (Scope scope = GlobalTracer.activateSpan(span)) {
ListenableFuture<?> future = tracedExecutor.submitListenable(() -> {
Thread.sleep(1000); // Let callback run in other thread
System.out.println(GlobalTracer.get().activeSpan()); // It's OK
});
future.addCallback(
r -> System.out.println(GlobalTracer.get().activeSpan()), // Context loss!
e -> {}
);
}
This is confusing me, the context (activeSpan
) is missed in the callback while the main task can get it correctly.
Metadata
Metadata
Assignees
Labels
No labels