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. If the first time the 
client library knows about the counter is when you increment it, then 
clearly it won't be able to export it until then.

On Wednesday, 3 May 2023 at 20:19:27 UTC+1 Johny wrote:

> I need to sum two separate counter metrics capturing request failures  to 
> compute ratio of error requests for an alerting signal. The code 
> initializing and setting these counters sits in separate modules preventing 
> reuse of one counter.
>
> The problem is when one of the counter is never incremented after a 
> restart, service never exports the data point, prometheus will never get 
> the time series and the summation will return nothing. 
>
> Is there a way to "force" publish a counter to 0 always on service reboot 
> during counter initialization to avoid this problem?
>
>  (fail_count1 + fail_count2) / (total_count1 + total_count2)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/8c36cde7-f503-48b9-9907-ecc9b8672afdn%40googlegroups.com.

Reply via email to