[BUG] Invalid transaction names in OTEL Java agent when using Tapir + Akka Http · Issue #4343 · softwaremill/tapir · GitHub
Skip to content

[BUG] Invalid transaction names in OTEL Java agent when using Tapir + Akka Http #4343

Open

Description

@Matzz

Tapir version: "1.11.13"
OTEL Java agent version: "2.11.0"
Scala version: "2.13.16"

Describe the bug

When using Tapir + Akka Http, OTEL Java agent sets the wrong transaction names. Only request method is included without url template.
Plain Akka Http routes provides correct transaction names.

How to reproduce?
Here is a sample application which depicts this issue. All steps to reproduce are described in README
https://github.com/Matzz/tapir-test/blob/main/README.md

Activity

  1. adamw commented on Feb 19, 2025

    @adamw
    Member

    I'm not that familiar with OTEL Java Agent, probably it has some Akka-specific instrumentation code. To work with Tapir, it would need to have Tapir-specific instrumentation code.

    Alternatively, we could try to generate Akka directives (in the tapir -> akka interpreter) which can be instrumented using the Java Agent, but for that, we would need details on how this instrumentation works

  2. masonedmison commented on Feb 19, 2025

    @masonedmison

    Hi @adamw I work with @Matzz, and we have been looking at this issue together. So it looks like the java agent computes the URI as part of this code. From what I can tell, tapir uses a more general mechanism to match the route (in FilterServerEndpoints?). Perhaps there could be an opportunity to use PatchMatcher when computing the path within PekkoServerRequest?

  3. adamw commented on Feb 20, 2025

    @adamw
    Member

    Thinking a bit more about this, I don't think we'll be able to use Akka/Pekko's mechanisms for path matching. Tapir uses a different approach, with path decoders that are defined as part of the inputs, and while translating this to path matchers would be in theory possible, it would be a lot of work. Probably much easier to add OTel/Tapir integration - e.g. through an interceptor (not "magical", just a simple interceptor), which would report the appropriate data when an endpoint is successfully decoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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