Un-incremented counters don't have value 0
See original GitHub issueWhen I navigate to my metrics endpoint, some counters don’t have values because they were never incremented. Such a counter is the unknown_failure_total
which gets incremented on unhandled exceptions.
I have Prometheus hooked up to Grafana and it keeps alerting me that there’s missing data for some counters. I don’t want to suppress this alert because missing data could also mean that Grafana is not able to reach my Prometheus server.
The HELP
and TYPE
statements are printed even for un-incremented counters, but their zero value is not. Should a 0 value be printed for counters which have yet to be incremented?
# HELP postgres_upsert_failure_total postgres_upsert_failure_total
# TYPE postgres_upsert_failure_total counter
postgres_upsert_failure_total{environment="production"} 2
# HELP unknown_failure_total cli_unknown_failure_total
# TYPE unknown_failure_total counter
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why is my counter incrementing in loop, but returns zero?
With my current project, I have to keep a counter of the number of insertions into a TreeMap<String, TreeSet<Song>> . The project is...
Read more >Please explain why counter does not increment
"CommandOne_Counter" is declared as "int CommandOne_Counter = 0;" near the top of the code in a udata section and I would expect it...
Read more >Solved CSE21 Lab 9: InheritanceTask 1: Counter.javaCounter
If the counter's value is 0, a call to decrement should have no effect. Otherwise, it should reduce the counter's value by 1....
Read more >Four ways to implement a synchronized counter in Java
Let's see how we can implement a synchronized counter in Java (For simplicity, we're implementing a counter which only increments the value, but...
Read more >Example: Counter Class
java is to have it inherit from Counter.java . It would inherit the increment and reset operations from Counter , replacing only the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Published in 10.0.1!
With labels present there’s no way to know the label values to display a default zero. However, once you’ve initialized the “child” with the label values by calling the
SimpleCollector#labels
method, you should see zero as in the no-labels case.