found the answer I did add a block like this

static { CD_PRODUCT_SUCCESS_CREATED .labels("podname"); ... }

for all the metrics and now I could see the 0.0 value for the metrics

Answer from R0b0t0 on Stack Overflow
🌐
GitHub
github.com › prometheus › client_python › discussions › 952
Prometheus Counter Zero Initialisation Problem · prometheus/client_python · Discussion #952
It is fine to just zero init the counter, Prometheus will assume the value reset to zero between scrapes if the value of a counter is lower than previously seen.
Author: prometheus
Discussions

Initializing prometheus counters to 0 whenever a new time series is created - Stack Overflow
I could work this out via Prometheus queries where I needed to count from zero, but the metrics were created with one after the first scrape. increase(sum(last_over_time(my_custom_counter_total[$__range]) or vector(0))[$__range:1m]) More on stackoverflow.com
🌐 stackoverflow.com
promql - Defaulting a prometheus counter metric to 0 - Stack Overflow
I'm facing a nightmarishly hard problem to solve for something that seems so trivial. Ultimately, I'm trying to detect a single increment of a counter metric in PromQL when there was no data previo... More on stackoverflow.com
🌐 stackoverflow.com
RFC: Counter initialisation
The solution to this problem is described in the Prometheus website: export 0 (or NaN, if 0 would be misleading) for any time series you know may exist in advance. Note that this solution does not cover the cases where the Prometheus scrape window did not catch the counter value at 0. For metrics without labels this is as simple as initialising ... More on github.com
🌐 github.com
16
June 27, 2019
Set Prometheus Counter value to 0 - Stack Overflow
I want to set Prometheus Counter value to 0 when the server restarts in a manner similar to, private static final Gauge SERVER_UP = Gauge.build(MetricConstants.SERVER_UP, "Server status"). More on stackoverflow.com
🌐 stackoverflow.com
🌐
Google Groups
groups.google.com › g › prometheus-users › c › w69L7w6Z5y0
A solution for counters automatic initialization to 0
October 6, 2022 - The workaround consist in manually initializing our metrics to 0. This can become complex with vectors when we don't know in advance the combination of label values, moreover we need to be sure the first scrape from Prometheus include this 0 value. At Goto.com we implemented a solution to this ...
🌐
GitHub
github.com › prometheus › client_ruby › issues › 141
RFC: Counter initialisation · Issue #141 · prometheus/client_ruby
June 27, 2019 - The solution to this problem is described in the Prometheus website: export 0 (or NaN, if 0 would be misleading) for any time series you know may exist in advance. Note that this solution does not cover the cases where the Prometheus scrape ...
Author: prometheus
🌐
Stack Overflow
stackoverflow.com › questions › 62782007 › set-prometheus-counter-value-to-0
Set Prometheus Counter value to 0 - Stack Overflow
private static final Gauge SERVER_UP = Gauge.build(MetricConstants.SERVER_UP, "Server status").labelNames(labels).register(); Gauge gauge = (Gauge) map.get(SERVER_UP); gauge.labels(serviceName, serviceType).set(0);
🌐
Robust Perception
robustperception.io › why-predeclare-metrics
Why predeclare metrics? – Robust Perception | Prometheus Monitoring Experts
August 13, 2018 - If you look at a typical use of ... with metrics, metrics that only some times exist are difficult to deal with in PromQL. By declaring the metric before your application uses it, the client library can initialise it to 0....
Find elsewhere
🌐
GitHub
github.com › argoproj › argo-events › issues › 3905
Prometheus Counters not initialized to zero when services start · Issue #3905 · argoproj/argo-events
February 5, 2026 - Counters in prometheus should always be initialized to a default value of 0 when the service starts. When they do not initialize to zero the first time the counter is increments prometheus ignores it when using things like rate() or increment().
Author: argoproj
🌐
GitHub
github.com › grafana › loki › pull › 1453 › files
pkg/promtail: Initialize counters to 0 when creating client by chancez · Pull Request #1453 · grafana/loki
countersWithHost = []*promethe... (Client, error) { c.client.Timeout = cfg.Timeout · // Initialize counters to 0 so the metrics are exported before the first ·...
Author: grafana
🌐
Google Groups
groups.google.com › g › prometheus-users › c › Wy4AwTklIs0
Set Counter Value to 0
I am using increase function to ... is incremented to 0. after second inc() the sum is 1. As a solution, I have initialised the counter to zero (by doing inc(0) ) for all labels in the application code as I know the labels in advance....
🌐
Google Groups
groups.google.com › g › prometheus-users › c › BBoVYf714eA
accumulating counter metric that are never incremented since restart
May 3, 2023 - Yes, you should be able to create a counter which publishes its initial value of zero. I'm fairly sure I've done this with the Golang client some time in the past. What language and client library are you using? You'll have to initialise the counters explicitly.
🌐
GitHub
github.com › siimon › prom-client › issues › 118
Un-incremented counters don't have value 0 · Issue #118 · siimon/prom-client
June 17, 2017 - 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 ...
Author: siimon
🌐
GitHub
github.com › prometheus-net › prometheus-net › issues › 63
Counter allows no way to reset to zero · Issue #63 · prometheus-net/prometheus-net
October 27, 2017 - The documentation at https://prometheus.io/docs/instrumenting/writing_clientlibs/ allows client libraries to offer a method to reset Counter values to zero.
Author: prometheus-net
🌐
GitHub
github.com › open-telemetry › opentelemetry-java › discussions › 5939
Support initial value in counters (Prometheus exporter) · open-telemetry/opentelemetry-java · Discussion #5939
October 25, 2023 - LongCounter MyCounter = meter .counterBuilder("my_app_my_counter") .withInitialValue(0) // <-- explicit initial value makes the value reported to Prometheus .build(); For completeness, here's the code we use to expose metrics to Prometheus thanks to OpenTelemetry Prometheus module: import io.opentelemetry.exporter.prometheus.PrometheusHttpServer PrometheusHttpServer prometheusServer = ...
Author: open-telemetry
🌐
GitHub
github.com › prometheus-net › prometheus-net › issues › 278
Is there a way to initialise metrics to 0 on startup ? · Issue #278 · prometheus-net/prometheus-net
December 8, 2020 - The increase function in promql doesnt consider the first increment which leads to data loss. Is there any way we can initialize counter value to 0 on startup?
Author: prometheus-net
🌐
DoiT
doit.com › home › blog › making peace with prometheus rate()
Making peace with Prometheus rate() | DoiT
February 17, 2023 - Insides of Kumistavi cave, known as Prometheus cave · When possible, initialize your counters with 0, so the metric will start to be reported immediately with, again, 0 as a value.
🌐
Javadoc.io
javadoc.io › doc › io.prometheus › simpleclient › 0.0.10 › io › prometheus › client › Counter.html
Counter (Prometheus Java Simpleclient 0.0.10 API)
Bookmarks · Latest version of io.prometheus:simpleclient · https://javadoc.io/doc/io.prometheus/simpleclient · Current version 0.0.10 · https://javadoc.io/doc/io.prometheus/simpleclient/0.0.10 · package-list path (used for javadoc generation -link option) · https://javadoc.io/doc/io....
🌐
SigNoz
signoz.io › guides › how to manage prometheus counters - best practices for servers
How to Manage Prometheus Counters - Best Practices for Servers | SigNoz
July 25, 2024 - Understand counter behavior: Counters only increase or reset to zero. Handle resets properly: Use Prometheus functions like increase() and rate().
🌐
Google Groups
groups.google.com › g › prometheus-users › c › uhJ9UUAF3Hg
First value of increase(Counter[Time]) doesn't count
July 4, 2023 - The counter may have been running and incrementing for a long time, before Prometheus starts scraping it; the first value you see could represent days or years of accumulation. That's why rate() and increase() only give a value if there are two or more adjacent data points. It's the only way to be sure that the value has actually increased over that time period. And if you don't generate an initial timeseries value of zero, then it can only use the next two values to calculate a rate between those two values.