[SR-Users] Reset Prometheus counter once

Vicente Hernando vhernando at sonoc.io
Thu Jul 16 12:41:12 CEST 2020


Hello Marat,

(my previous email did not pass moderation filter)

modparam only declares a counter because it only defines label names.

When a counter is added or reset then label values are set so the 
counter is actually created.

If you want a counter to be reset once, you could use a trick. May be 
setting a shared variable,
change that variable first time used and execute prom_counter_reset 
inside an if to check
the value of that variable.


Regards,
Vicente.



On 7/15/20 11:06 AM, Marat Gareev wrote:
> Hello.
>
> Are there any ways to reset the Prometheus counter once?
> I can do something like this, but counter will be reset on each request
>
>     loadmodule "xhttp_prom.so"
>     modparam("xhttp_prom", "prom_counter", "name=mycounter;")
>     route {
>         prom_counter_reset("mycounter");
>     }
>
>
> Otherwise, I will not receive the counter until a special and rare 
> event occurs.
>
> Regards,
> Marat
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200716/5f26319f/attachment.htm>


More information about the sr-users mailing list