client_java
client_java copied to clipboard
How to use gauge histograms?
OpenMetrics 1.0.0 added the metric types STATE_SET, INFO and GAUGE_HISTOGRAM.
I noticed that the classes Enumeration and Info have been added in response (#615), and these correspond to STATE_SET, INFO.
However, I see no new class corresponding to GAUGE_HISTOGRAM.
I have looked at the TextFormat class, and IIUC, it handles a gauge histogram as a set of gauges.
Am I right in thinking there will be no GaugeHistogram class?
Should we instead create a set of gauges and submit that to prometheus client java?
In short, do you have any documentation or examples showing how to build a gauge histogram?
Thank you
I have found the following unit test: https://github.com/prometheus/client_java/blob/master/simpleclient_common/src/test/java/io/prometheus/client/exporter/common/TextFormatTest.java#L172-L203
Please feel free to close this issue if you confirm this is how it is supposed to be used.
:+1: great that you found the unit test. Yes, this is currently the way how to create a GaugeHistogram.
If you have a proposal for a better API for GaugeHistogram, please let me know.
OpenMetrics defines the semantics of GaugeHistogram as follows:
GaugeHistogramsmeasure current distributions. Common examples are how long items have been waiting in a queue, or size of the requests in a queue.
So I don't think an observe() method makes sense, as GaugeHistogram is not intended to track events.
Anyway, if you have a use case that might be relevant for others and a proposal how to support this better, let me know.
Gauge.build() without help ,how to fix the case?