Interview Prep/Monitoring & Observability/Observability Fundamentals & Signals

Why should you never use a gauge to count requests?

BeginnerConceptObservability Fundamentals & Signals
Answer

A gauge sampled every 15s loses everything that happened between scrapes, and if it is reset per interval you lose data when a scrape is missed. A counter is cumulative, so rate() over any window gives the correct average even if scrapes are missed, and counter resets on restart are detected and handled automatically by rate()/increase().

Rule: if you would ask "how many per second?", it is a counter.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Observability Fundamentals & Signals