opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Fix pekko route naming

Open samwright opened this issue 8 months ago • 2 comments

There are a few problems with the http.route values generated in pekko's instrumentation.

  1. Path matching does not need to end with a PathEnd matcher, as the current solution assumes, e.g.:
pathPrefix("foo" ~ not("bar")) { complete("ok") }

will match /fooabc/123, but no http.route is generated. Given the glob-style approach of using * to represent a captured variable, I suggest the correct http.route here should be /foo**.

  1. pathPrefix doesn't work as expected, e.g.
pathPrefix("a") {
  pathPrefix("b") {
    path("c") {
      complete("ok")
    }
  }
}

will match /a/b/c, but the http.route generated is abc.

This solves those issues, and adds a variety of PathMatchers to the tests.

samwright avatar Mar 11 '25 08:03 samwright

will match /fooabc/123, but no http.route is generated. Given the glob-style approach of using * to represent a captured variable, I suggest the correct http.route here should be /foo**

I personally would prefer /foo* to /foo**

laurit avatar Mar 11 '25 13:03 laurit

@laurit @masonedmison any other comments?

samwright avatar Mar 20 '25 07:03 samwright