-
Notifications
You must be signed in to change notification settings - Fork 819
Add new option DisableAppendingUnitName in order to avoid appending the unit name in the metric name #6241
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
base: main
Are you sure you want to change the base?
Conversation
|
4766821
to
aa32609
Compare
…he unit name in the metric name
aa32609
to
623d32c
Compare
Default value is false, so there should be no breaking change for existing users. Still, we're very hesitant to make changes to the public api. |
Thank you for your feedback! I understand the hesitation, still, there is already a similar option in the public api to disable appending the Total for the counters (DisableTotalNameSuffixForCounters), so this change is in accordance to the existing public API and the benefits of having this option would be great for migrating existing apps from prometheus-net, which is a very popular and commonly used library. Regarding the OpenTelemetry specification, correct me if I'm wrong, it doesn't specifically mention that the unit name MUST be present, but IF present, that it MUST be converted to the unit of the OTLP metric. https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/ So, based on the above reference, I believe that we don't break the specification here, since we are simply controlling if the unit name is present or not, which I don't see that is strictly required in the specification. Again, this is my understanding of the specification, feel free to correct me or point me to another section of the specification 🙏 Last but not least, this change was driven out of need, since I am currently trying to migrate to OpenTelemetry metrics from prometheus-net, and with the current implementation of the api, all the Grafana dashboards would break. Thank you very much checking this in any case! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see anything in the spec that permits us to add a configuration disabling the unit suffix.
I understand the hesitation, still, there is already a similar option in the public api to disable appending the Total for the counters (DisableTotalNameSuffixForCounters)
The spec explicitly permits a configuration option for disabling the addition of the _total
suffix, specifically for counters.
Exporters SHOULD provide a configuration option to disable the addition of _total suffixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking, per #6241 (review)
Thank you for the reference link, I wasn't aware of this detail... If there is a way to add this functionality in another way, without affecting the public API, would that be acceptable? |
HI @Gpower2, I think you should open a new Feature Request Issue to discuss your problem and possible solutions. I don't work with Metrics very much, but have you explored if you can use Views to rename the metrics? |
Thank you very much about the hint for the Views, this could be a workaround from what I gather, though I am not sure if this would affect the overall performance, definitely worth checking it out! Regarding the Feature Request, could you give me a link or guide on where and how to open it? 🙏 |
Here's how you can open a Feature Request (screenshot). |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Fixes #
This PR is adding a new option named "DisableAppendingUnitName" in the PrometheusAspNetCoreOptions and the PrometheusExporterOptions classes, in order to support the creation of metric names without appending the unit name.
This is very useful for migrating existing implementations that use prometheus-net to the opentelemetry-dotnet as a drop-in replacement.
I believe that Go exporter already has the same functionality but this is missing from the dotnet exporter.
I know that this adds a new option in the public API, but I believe that it will help a lot with migrating from prometheus-net for a lot of projects as already mentioned.
Changes
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes