we are using prometheus-net and I couldnt find any way we could initialize the counter metric to 0 https://github.com/prometheus-net/prometheus-net On Tuesday, 8 December 2020 at 22:47:00 UTC+5:30 [email protected] wrote:
> On 08.12.20 07:37, TEST TEST wrote: > > > > I am using increase function to track the counter increase to track the > > number of logins in the web application. We are observing a strange > > scenario, where after an idle time or after the web application is > > redeployed, the counter is not considering the first login after the > > reset. > > > > Is there any way to fix this issue ? > > Maybe you are only initializing the counter when you increment it for > the first time? See > https://www.robustperception.io/why-predeclare-metrics as a starter. > > If you initialize the login counter to 0 upon starting up the app, it > should work (provided Prometheus scrapes the app before the first > login happens). > > Even if certain trolls (which none of us should ever feed) claim the > opposite, Prometheus cannot know when a time series being scraped for > the first time has started to exist. If the first value Prometheus > sees for the login counter is a 1, it could in principle have been > there for a very long time already. > > (I am contemplating using the new OpenMetrics creation timestamp to > break out of this "existential issue", but even that is not as easy as > it looks.) > > -- > Björn Rabenstein > [PGP-ID] 0x851C3DA17D748D03 > [email] [email protected] > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/fef9862f-69d9-4810-8a03-3f4e315fb369n%40googlegroups.com.

