-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
The names of the metrics produced by the new meters do not seem clear #48309
Comments
The standard way to export metrics counters to Prometheus is to use OpenTelemetry. However, the OpenTelemetry standard for exporting to Prometheus creates a problem: the counter name in Prometheus is just the metrics counter name, and the Meter is added as a label to the counter value. The relevant part of the OTel spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope. I think this design was chosen so OTel could round-trip data without data loss. If they did something different, like combining the meter and counter names in Prometheus, then when values came back to OTel, OTel wouldn't know where to split them up. Problem: The existing event counter names in .NET assume the event source name and counter name are combined - https://learn.microsoft.com/en-us/dotnet/core/diagnostics/available-counters. An example of a counter that isn't unique is "current-requests". Both Microsoft.AspNetCore.Hosting and System.Net.Http have it. Unfortunately, combining the meter and counter name to create a unique identifier doesn't hold in the cloud-native tooling world of metrics. What someone sees in Prometheus when searching for metrics: What does current_requests mean? Current requests of what? Or what does connection duration mean? Is it duration for HTTP connections or SQL connections? etc In the cloud-native world, OpenTelemetry is the library for gathering metrics, and Prometheus is the metrics database. I think we need to cater to their way of doing things. Solution: |
For a bunch of reasons:
We'd prefer .NET to consistently follow its own standard instead be 90% similar to OTel's. Being almost the same as another spec but still incompatible has stung us in the past. |
And that's a shame. Microsoft should be a driving force in standardizing things rather than creating a new standard/convention within a project (especially for a new feature). If only 10% of the metrics/attributes are missing in the OTel specification, why not contribute and propose to add them? |
Thoughts @reyang?
We need room for both. There will always be things that are implementation specific that need to be counted and we aren't not going to add them because they aren't in the otel spec. It's like how chromium adds support for new APIs with a different prefix until it becomes standard, then the API becomes the standard. |
I'm an active member of the OpenTelemetry Technical Committee and I can provide some context and also share my thinking:
|
cc @geeknoid as we need to align metrics names in https://github.com/dotnet/extensions too |
Summary
#47536 introduced metrics for ASP.NET Core through the new metrics API and this new feature is really cool!
However, I'm not sure to understand the choice for the name of the metrics and they don't seem to follow the OpenTelemetry specification. Let's take for example the metric
current-requests
recorded by the meterMicrosoft.AspNetCore.Hosting
. Following the OTEL specification, the name should instead behttp.server.active_requests
. The namecurrent-requests
is not clear enough. When I browse the metrics available in my Prometheus or via dotnet-counters, I don't know if the current-requests metric corresponds to the number of active incoming (server) or outgoing (client) requests, whereashttp.server.active_requests
is immediately clearer.I may be wrong, can anyone help me?
cc @JamesNK
The text was updated successfully, but these errors were encountered: