Skip to content

suboptimal behavior of @Traced when applied to methods that don't finish synchronously #189

Description

@Ladicek

There's a couple of "context propagation" issues in this issue tracker already, but I think this deserves its own :-)

Say I have a CDI bean with a @Traced method, which returns a CompletionStage. This can be for example:

  • a method that is annotated with MP Fault Tolerance @Asynchronous and therefore is executed on an extra thread
  • a method that uses MP Context Propagation's ManagedExecutor to defer execution of some part of the method

Such method can be called for example from a JAX-RS endpoint, where the method also returns CompletionStage (this is standard since JAX-RS 2.1).

In such case, whatever is done to the span asynchronously (after the @Traced method returns) may be lost, and that is even if I hack together OpenTracing context propagation (which we've done in SmallRye Fault Tolerance). This is because the @Traced interceptor closes the scope synchronously. That's of course a correct/specified behavior, but I think it's also rather suboptimal.

We should find a way how to make these scenarios work. Integrating with Context Propagation is necessary, but not enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions