Bringing the discussion from github to here to get more feedback.
https://github.com/prometheus/prometheus/issues/8763
At present the format used by count_values isn't specified in
documentation. (It ends up using %f formatting). There are times when
it is useful for count_values resulting label to be compatible with
the labels produced for histogram "le" labels. (one such case is
documented here,
https://medium.com/@tristan_96324/prometheus-apdex-alerting-d17a065e39d0)
While in the provided example, it is possible to produce the "le"
label for matching via other means), it would still be convenient to
offer a method of controlling the format used by count_values.
In the github issue referenced about, it has been suggested that
count_values arguments could be used to control the value format.
We've suggested allowing a fmt.Printf style (actually
strconv.FormatFloat), specification to be appended to the label name,
perhaps via a comma. e.g.
count_values("le,g.2")
In addition, to support the bucket labels produced for OpenMetrics
histograms, we could use 'o' to facilitate OpenMetrics compatible
formatting (this is %g with s potential additional .0 appended to
exact integer values). 'o' is unused by FormatFloat.
I'm willing to undertake the work, if people agree, but appreciate
that the method of specifying a formatting here probably warrants
wider discussion.
--
Tristan Colgate-McFarlane
----
"You can get all your daily vitamins from 52 pints of guiness, and a
glass of milk"