Skip to content
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

How to use gauge histograms? #807

Open
JnRouvignac opened this issue Aug 18, 2022 · 3 comments
Open

How to use gauge histograms? #807

JnRouvignac opened this issue Aug 18, 2022 · 3 comments

Comments

@JnRouvignac
Copy link

JnRouvignac commented Aug 18, 2022

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

@JnRouvignac
Copy link
Author

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.

@fstab
Copy link
Member

fstab commented Aug 23, 2022

👍 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:

GaugeHistograms measure 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.

@wangsonggogo
Copy link

Gauge.build() without help ,how to fix the case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants