opentelemetry-js
opentelemetry-js copied to clipboard
Add request path to http-instrumentation metric histogram
NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.
Is your feature request related to a problem? Please describe.
I want to have an OTEL histogram that measures HTTP response timings for my server by method, path, and status code as these are very useful operational telemetry to collect.
Describe the solution you'd like
For the http-instrumentation histogram here:
Add the ability to include the request path, stripped of query params, to the histogram to make the data more useful. Could be a flag, a custom hook, or by making it a default field. Right now the histogram data isn't very actionable without it:
http_server_duration_bucket{http_scheme="http",http_method="GET",net_host_name="localhost",http_flavor="1.1",http_status_code="200",net_host_port="3000",le="0"} 0
Describe alternatives you've considered
Creating a custom histogram / counter, but looking into the implementation of _closeHttpSpan, there are lots of little details that are difficult to account for (errors, closed connections, etc).
Additional context
Add any other context or screenshots about the feature request here.