-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix: http_route is not recorded by server metric while using servlet 2/3 #12353
#12354
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: http_route is not recorded by server metric while using servlet 2/3 #12353
#12354
Conversation
…on `getHttpRoute()` Class `ServletHttpAttributesGetter`always returns null for the getHttpRoute() function because it does not override the getHttpRoute() method. As a result, the class uses the default function from its superclass.
|
|
The description of |
Hi @laurit, I see your idea. But if this attribute is missing, the metric will not be able to display the corresponding request URIs in the Server metric metric (all). This thing make us confused and can not use server metric of default opentelemetry. We have to custom another server metric for this label. Have you any idea for it? |
Metrics may not use high cardinality attributes such as URI, that is why we have the route. If you are using a higher level framework that builds on top of servlets it may be possible to extract route from there. |
Well, I think you mean we need to customize another HTTP server metric instead of using the default one provided by OpenTelemetry if we're using any framework that relies on a servlet version below v3, right? |
No. Framework specific instrumentation provides the route that is used by the standard metrics. Have a look at https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md in |
I see your point. So I think need to build another instrument (as extension) for server metric with servlet instead of use server metric of open telemetry in this situation. Thanks for your review! |
What web framework are you using? Instrumenting the web framework to update the route would also work. Or you could call one of the |
Currently, we are integrating with Jetty embedded (v9.x), which uses Servlet v3 to publish HTTP endpoints. While the update method mentioned above can address this issue, the default histogram with 10 buckets still causes the metrics to grow excessively. Do you have any ideas about customizing the configuration for this? |
Class
ServletHttpAttributesGetteralways returns null for the getHttpRoute() function because it does not override the getHttpRoute() method. As a result, the class uses the default function from its superclass andhttp_routewill be assigned tonull