chore: Add http_route label to HTTP server metrics #2330
+76
−37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
This PR adds the
http_routelabel to standard HTTP server metrics collected by the otelhttp package. This enables users to collect HTTP metrics per route.Because
WithMetricAttributesFnis 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 newerhttp_server_request_naming convention rather than justhttp_server_.What is the current behavior?
Currently, the
http_server_duration_milliseconds_bucketmetric 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:
http_server_duration_milliseconds_bucketmetric is renamed tohttp_server_request_duration_seconds_buckethttp_server_request_duration_seconds_bucketmetric has an additional label,http_route, that matches thehttp_routelabel in thehttp_status_codes_totalmetric