Interview Prep/Monitoring & Observability/Prometheus and PromQL at Scale

A deploy restarts pods and counters reset. Will `rate()` show a drop? What about `increase()`?

BeginnerScenarioPrometheus and PromQL at Scale
Answer

Situation read → Counters reset to zero on process restart. Prometheus handles that for you.

What I'd do →

  1. rate() and increase() detect a decrease as a reset and treat the post-reset value as an increase from zero. No negative spike.
  2. Only apply them to counters. For gauges use deriv() or delta().
  3. increase(x[1h]) is rate(x[1h]) * 3600, extrapolated at the window edges, so it may return non-integers like 9.97 for a count that is really 10.
  4. Never graph a raw counter, as its value is meaningless on its own.

Why → Counters make restarts safe and make scraping losses recoverable, which is why they are preferred over gauges for totals.

Interview tip → Mention that irate is for volatile fast graphs only. Do not use it in alerts.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus and PromQL at Scale