-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
While using the OpenTelemetry Java agent on an application that uses Servlet 2.0/3.0, the http_route attribute is not recorded by the server metrics. It appears as follows:
http_server_request_duration_seconds_count{http_request_method="POST",http_response_status_code="200",network_protocol_version="1.1",otel_scope_name="io.opentelemetry.jetty-8.0",otel_scope_version="2.8.0-alpha",url_scheme="http"}
Steps to reproduce
Here's a clearer and more structured version of your steps:
-
Build HTTP Server Using Jetty Embedded 9.3 (Servlet 3.0)
- Create an HTTP server using Jetty embedded 9.3, which supports Servlet 3.0.
-
Run Java Agent with Prometheus Exporter Enabled on Port 9464
- Start the application with the OpenTelemetry Java agent and enable the Prometheus exporter on port
9464:
java -javaagent:opentelemetry-javaagent.jar -Dotel.metrics.exporter=prometheus -Dotel.exporter.prometheus.port=9464 -jar myapp.jar
- Start the application with the OpenTelemetry Java agent and enable the Prometheus exporter on port
-
Send a Request to the Application
- Make a request to the running application to trigger the server-side metrics:
curl http://localhost:8080/your-endpoint
-
Load Metrics via Prometheus
- Retrieve the metrics exposed by the Prometheus exporter:
curl http://localhost:9464/metrics
-
Find the
http_server_request_duration_seconds_countMetric- Look for the
http_server_request_duration_seconds_countmetric in the Prometheus output to check the recorded server request duration.
- Look for the
Expected behavior
The metric http_server_request_duration_seconds_count should contain the http_route attribute
http_server_request_duration_seconds_count{http_request_method="POST",http_response_status_code="200",http_route="/api/hello",network_protocol_version="1.1",otel_scope_name="io.opentelemetry.jetty-8.0",otel_scope_version="2.8.0-alpha",url_scheme="http"} 1
Actual behavior
The metric http_server_request_duration_seconds_count does not contain the http_route attribute.
http_server_request_duration_seconds_count{http_request_method="POST",http_response_status_code="200",network_protocol_version="1.1",otel_scope_name="io.opentelemetry.jetty-8.0",otel_scope_version="2.8.0-alpha",url_scheme="http"} 1`
Javaagent or library instrumentation version
2.8.0
Environment
JDK: OpenJDK 11.0.23
OS: Ubuntu 20.04
Jetty Embedded 9.3, Servlet 3
Additional context
No response