Open exarkun opened 2 years ago
I think using the Metric
objects would probably be fine for this case, I believe that documentation for internal use is for creating custom collectors you should use the more specifically typed collectors instead.
That said, I think adding some testing utilities would be nice. The Go client has a package of test utilities that could be a good reference: https://pkg.go.dev/github.com/prometheus/client_golang@v1.11.0/prometheus/testutil.
I have an application that uses
Histogram
. I want to write some tests that assert that my application is putting values into the right buckets of that histogram.To read values out of the Histogram it seems that need to either:
_buckets
attribute, orHistogram.collect
and look at the resultingMetric
objects which are documented as "intended only for internal use" and then look at itsSamples
which aren't documented at all.Neither of these seems particularly satisfactory. It would be very helpful if
client_python
provided some way to read bucket counts and the total sum from aHistogram
, using documented APIs clearly marked as intended for external use (perhaps only in test suites).