Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

proposal: exporter/prometheus: allow adding units to metrics names #814

Open
semistrict opened this issue Jul 9, 2018 · 5 comments
Open

Comments

@semistrict
Copy link
Contributor

See: census-instrumentation/opencensus-specs#127

We should support easily adding units to metric names. Unfortunately, I don't think we can safely change the default outright but we can change all the examples and add documentation. Perhaps we can come up with a way to deprecate the current default and replace it with a better default in line with the deprecation policy.

From the specs issue, I suggested something like:

e := prometheus.NewExporter(..)
e.NameFormatter = func(v *view.View) string {
  return fmt.Sprintf("%s_%s", v.Name, v.Unit)
}
@semistrict
Copy link
Contributor Author

semistrict commented Jul 9, 2018

We should also provide a recommended out-of-the-box NameFormatter that complies with https://prometheus.io/docs/practices/naming/#metric-names

@rakyll
Copy link
Contributor

rakyll commented Jul 9, 2018

Can we track feature requests like this on the specs repo? It has to be implemented in every language.

@semistrict
Copy link
Contributor Author

The original issue is in the specs repo. This is the Go-specific part.

@rakyll
Copy link
Contributor

rakyll commented Jul 13, 2018

census-instrumentation/opencensus-specs#127 is only a proposal to add unit names.

If custom metric names are required, there needs a spec issue to track it. When a spec change is just proposed, it doesn't mean it is accepted. don't open issues on the language repos until a spec is accepted. Other contributors see an issue on this repo and try to contribute a change.

@rakyll rakyll closed this as completed Jul 13, 2018
@semistrict semistrict changed the title Make Prometheus metric names customizable Prometheus exporter does not follow metric naming guidelines Jul 16, 2018
@semistrict
Copy link
Contributor Author

I understand the objection to changing the scope of this to allow complete customization of metric names. I have retitled this to focus on the bug, which is that we currently generate names that are not compatible with the recommended naming conventions in: https://prometheus.io/docs/practices/naming/#metric-names

My suggestion of allowing customization of metric names is only one solution to this problem. I can understand if you think this is too broad a solution. In that case, perhaps a more targeted solution to fix the issue in a backwards-compatible way would be fine. I do think that this is an issue with the Prometheus exporter for Go and so I am reopening.

@semistrict semistrict reopened this Jul 16, 2018
@odeke-em odeke-em changed the title Prometheus exporter does not follow metric naming guidelines proposal: exporter/prometheus: allow adding units to metrics names Aug 20, 2018
@rghetia rghetia added P1 and removed enhancement labels Mar 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants