-
Notifications
You must be signed in to change notification settings - Fork 919
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
Fix pekko route naming #13491
base: main
Are you sure you want to change the base?
Fix pekko route naming #13491
Conversation
I personally would prefer |
.../io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerTracer.java
Outdated
Show resolved
Hide resolved
...io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/route/PekkoRouteHolder.java
Outdated
Show resolved
Hide resolved
...io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/route/PekkoRouteHolder.java
Outdated
Show resolved
Hide resolved
...javaagent/instrumentation/pekkohttp/v1_0/server/route/RouteConcatenationInstrumentation.java
Outdated
Show resolved
Hide resolved
...javaagent/instrumentation/pekkohttp/v1_0/server/route/RouteConcatenationInstrumentation.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back to using PekkoRouteHandler from the Tapir instrumentation, since this lets people combine pekko path-matching with tapir path-matching. I doubt there's a good reason anyone would do that, but it was working before this PR so I shouldn't break it. I added a test to confirm.
@@ -19,6 +23,7 @@ | |||
import sttp.tapir.server.ServerEndpoint; | |||
|
|||
public class RouteWrapper implements Function1<RequestContext, Future<RouteResult>> { | |||
private static final Uri.Path EMPTY = Uri.Path$.MODULE$.apply("", Charset.defaultCharset()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the only way to get the Uri.Path.Empty
object from java - apparently once it's 3 or more levels deep, accessing nested scala classes from java gets tricky.
...o/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/route/PekkoRouteWrapper.java
Show resolved
Hide resolved
...ava/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/tapir/RouteWrapper.java
Show resolved
Hide resolved
@laurit @masonedmison any other comments? |
There are a few problems with the
http.route
values generated in pekko's instrumentation.PathEnd
matcher, as the current solution assumes, e.g.:will match
/fooabc/123
, but nohttp.route
is generated. Given the glob-style approach of using*
to represent a captured variable, I suggest the correcthttp.route
here should be/foo**
.pathPrefix
doesn't work as expected, e.g.will match
/a/b/c
, but thehttp.route
generated isabc
.This solves those issues, and adds a variety of PathMatchers to the tests.