auth icon indicating copy to clipboard operation
auth copied to clipboard

chore: Add http_route label to HTTP server metrics

Open jnschaeffer opened this issue 4 days ago • 1 comments

What kind of change does this PR introduce?

This PR adds the http_route label to standard HTTP server metrics collected by the otelhttp package. This enables users to collect HTTP metrics per route.

Because WithMetricAttributesFn is only available in newer versions of otelhttp, this commit also upgrades the otelhttp package to v0.63.0. As a result, HTTP request metrics now use the newer http_server_request_ naming convention rather than just http_server_.

What is the current behavior?

Currently, the http_server_duration_milliseconds_bucket metric does not include HTTP route labels. This means HTTP duration metrics are heavily skewed towards fast, frequently accessed API routes such as /user.

What is the new behavior?

There are two changes introduced in this PR:

  • The http_server_duration_milliseconds_bucket metric is renamed to http_server_request_duration_seconds_bucket
  • The http_server_request_duration_seconds_bucket metric has an additional label, http_route, that matches the http_route label in the http_status_codes_total metric

jnschaeffer avatar Jan 15 '26 03:01 jnschaeffer