-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix pekko route naming #13491
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
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
samwright
left a comment
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.
| 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.routevalues generated in pekko's instrumentation.PathEndmatcher, as the current solution assumes, e.g.:will match
/fooabc/123, but nohttp.routeis generated. Given the glob-style approach of using*to represent a captured variable, I suggest the correcthttp.routehere should be/foo**.pathPrefixdoesn't work as expected, e.g.will match
/a/b/c, but thehttp.routegenerated isabc.This solves those issues, and adds a variety of PathMatchers to the tests.