What is the difference between rate() and irate()? [Basic]
Answer
rate() uses all samples in the range and gives a smoothed average rate. irate() uses the last two samples and reacts faster, but it is noisier. I use rate() for alerts and dashboards, and reserve irate() for short-term debugging graphs.
Technical explanation
rate() is more stable and better for SLOs, alerting, and capacity trends.
irate() can reveal sudden spikes but can also produce false impressions when scrape intervals or traffic are uneven.
For low-traffic services, longer rate windows are usually better than irate().
Hands-on example
Hands-on: graph rate(container_cpu_usage_seconds_total[5m]) for normal CPU trend and irate(container_cpu_usage_seconds_total[1m]) while debugging a sudden CPU burst. Do not page on irate unless you have proven it is stable and actionable.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Observability interview questions
- How do you compute a 95th percentile latency from a histogram in PromQL (histogram_quantile)? [Basic]
- What is PromQL, and what is an instant vector versus a range vector? [Basic]
- What is the Pushgateway, and why is it discouraged for most cases? [Basic]
- What is a recording rule, and when would you use one? [Basic]
- What is the difference between an exporter and instrumenting your app directly? [Basic]
- What is an alerting rule, and how does it differ from a recording rule? [Basic]
- What is a scrape target, and how does service discovery find them? [Basic]
- How does Prometheus collect metrics — what is the pull model and scraping? [Basic]