Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproducer: Span operation name duplicated when more than 1 endpoint defined per route #1063

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

seglo
Copy link
Contributor

@seglo seglo commented Oct 18, 2021

I'm using sbt-guardrail to generate akka-http Routes from an OpenAPI spec. I'm instrumenting these endpoints with Kamon's akka-http integration. I noticed that the way sbt-guardrail generates the akka-http Route sometimes causes an issue with how operation names are generated for spans. Guardrail will define Routes by their path and then define the HTTP verb as a nested Directive. This appears to cause confusion with how paths are matched in the akka-http/Kamon akka-http server instrumentation code.

i.e.)

val route = 
      path("some_endpoint") {
        post(complete(OK))
      } ~
      path("some_endpoint") {
        get(complete(OK))
      }

Reproducer test fails with:

[info] AkkaHttpServerTracingSpec:
[info] the Akka HTTP server instrumentation with HTTP/1
[info] - should return the correct operation name with overloaded route *** FAILED ***
[info]   "/some_endpoint[/some_endpoint]" was not equal to "/some_endpoint[]" (AkkaHttpServerTracingSpec.scala:89)

@ivantopo
Copy link
Contributor

Hey @seglo, thanks a lot for this reproducer 🙏

I managed to fix the issue and pushed the changes (along with squashing your 2 commits) into this PR. Hopefully that will be it. I'll get back to this later today/tomorrow and merge 😄

@seglo
Copy link
Contributor Author

seglo commented Oct 19, 2021

Excellent. TYVM @ivantopo!

@ivantopo ivantopo merged commit 8a9cc53 into kamon-io:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants