Skip to content

Jetty 11 instrumentation sets http.route to /* instead of actual route #13802

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

Open
vincentlejeune opened this issue Apr 30, 2025 · 2 comments
Open
Labels
needs author feedback Waiting for additional feedback from the author stale

Comments

@vincentlejeune
Copy link

Hello OpenTelemetry team,

I'm using the OpenTelemetry Java agent to instrument my Java application, which runs on Jetty 11. I've noticed that all HTTP server spans have the http.route attribute set to /*, regardless of the actual request path. However, the url.path attribute correctly reflects the full request path.

I understand that the Jetty 11 instrumentation is supported, as per the supported libraries documentation. However, it seems that the instrumentation does not capture the specific route patterns, leading to http.route being set to a generic /*.

I attempted to manually instrument the application to set the http.route attribute more accurately. While this approach allows me to set the desired value, it results in duplicate spans in my traces.

Is there a recommended way to have the Jetty 11 instrumentation capture the correct http.route values without resorting to manual instrumentation? Alternatively, is there guidance on how to suppress the automatic spans when adding manual instrumentation to avoid duplication?

Thank you for your assistance.

@laurit
Copy link
Contributor

laurit commented May 2, 2025

This is expected. https://opentelemetry.io/docs/specs/semconv/attributes-registry/http/ sets the following requirements for the route

MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

For servlets the best we can use for route the is the path that the servlet is mapped to. Usually route is provided by a higher level framework that runs on top of jetty or other servlet container.
You can set the route from the application by calling

this is what framework instrumentations also use.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label May 2, 2025
Copy link
Contributor

github-actions bot commented May 9, 2025

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.

@github-actions github-actions bot added the stale label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs author feedback Waiting for additional feedback from the author stale
Projects
None yet
Development

No branches or pull requests

2 participants