-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Empty "http.route" tags should be set to "/" #62432
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
Empty "http.route" tags should be set to "/" #62432
Conversation
@dotnet-policy-service agree |
Feel free to ping me whenever someone in the team have time to review this :) And finally, if this feature can be backported in .NET 9 I would be extremely happy as it's producing lots of erroneous data in my monitoring stack 😅 (thus why I noticed this) |
(This PR is awaiting further discussions in #62431 ) |
e9b92c4
to
c70dbcb
Compare
Rebased on latest main, and applied changed decided in #62431 |
These changes have been decided in #62431
a6af20f
to
afa7fa2
Compare
@Elanis I rebased and updated the routing metric to be consistent. |
Thanks! |
/backport to release/10.0-rc1 |
Started backporting to release/10.0-rc1: https://github.com/dotnet/aspnetcore/actions/runs/17082938754 |
HostingMetrics: empty "http.route" tags shouldn't be present
When pushing metrics to third-party softwares such as prometheus. Having empty-valued labels will cause issues
Description
Microsoft.AspNetCore.Hosting
create a metric calledhttp.server.request.duration
documented here: https://learn.microsoft.com/en-us/aspnet/core/log-mon/metrics/built-inOne the available labels is
http.route
which is optional.Issue:
http.route
can be populated with various string such as:And it can also be missing.
However, based on the OpenMetrics spec used by Prometheus, empty label values should be treated as if the label was not present.
That means when exporting data to prometheus, we currently create two different metrics (one for http_route= <empty string>, one for the missing http_route), which create a "duplicate sample for timestamp" error when importing data.
Fix:
To fix this issue, I changed the metric labelling so an empty route doesn't create the label, as if the variable was null.
Fixes #62431