javaspring-bootcompletable-futureopentracingotel

Parent Span is getting ended after propagating to a completable future


I have a Service class that is calling a DAO method from a CompletableFuture.supplyAsync() method with a Context-wrapped Executor service. Here the propagation is working fine and can see the same parent span active., but the moment I invoke a DB call, a child span is created, and the parent span is ended. Is there a way to keep the parent span alive until the complete process finishes?

Here I am using the otel spring boot starter with spring boot 3

followed this for wrapping : https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/6201

Span.currentSpan().isRecording() is true before starting the CF.


Solution

  • This was a bug and its fixed with #issue