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

Initialising counter metrics #53

Open
bernardd opened this issue Feb 3, 2023 · 1 comment
Open

Initialising counter metrics #53

bernardd opened this issue Feb 3, 2023 · 1 comment

Comments

@bernardd
Copy link

bernardd commented Feb 3, 2023

Please forgive me if this is a dumb question - I'm still learning my way around metrics in general and Prometheus in particular.

Would it make sense to have, at least as an option, the ability to initialise counter metrics to 0 when they're first set up? As it stands (if my reading of things is correct), they'll return a null value until the first time they're incremented. That leads to a not-entirely-intuitive result when later you're using the increase function in PromQL and the very first event doesn't count because there's no "increase" between null and 1.

@MzudemO
Copy link

MzudemO commented Mar 27, 2024

Seconding this, as it is also recommended by Prometheus https://prometheus.io/docs/practices/instrumentation/#avoid-missing-metrics

The issue here is it isn't possible to know (at supervisor start) which counters to initialize because you can have arbitrary values in tags, where each new tag value creates a new counter. I'm not sure if sending a 0 event first when encountering the initial 1 for a counter would help in PromQL?

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

No branches or pull requests

2 participants