rate()
The PromQL function that turns a counter into its average increase per second over a time window, handling restarts.
In more detail
rate is the natural input to traffic panels and error ratios. A short window reacts quickly but is noisy; a long window is steadier but hides brief surges, so state the window in the question.
Example
rate(http_requests_total[5m])Related terms
- counter — A metric that only ever goes up, such as the total number of requests or errors, from which rates are calculated.
- increase() — The PromQL function that reports how much a counter grew in total over a time window, handling restarts.
- counter reset — The moment a counter drops back to zero, usually because the process restarted.
- range vector — A PromQL selection of every sample in a time window for each series, written with a duration in square brackets such as [5m].
- time window — The stretch of time a query or objective looks across, such as the last 5 minutes or 30 days.
Taught in
- Metric Types: Counters And Gauges — Full-Stack Observability: Metrics, Tracing & Logging
- Rates And Increases Over Time — Full-Stack Observability: Metrics, Tracing & Logging
- Calculating Percentiles With histogram_quantile — Full-Stack Observability: Metrics, Tracing & Logging
- Grafana: Connecting The Data Source — Full-Stack Observability: Metrics, Tracing & Logging
- Six Minutes Nobody Saw: Prometheus In One Outage — Prometheus Certified Associate (PCA) Exam Prep
- Four Thousand Requests Vanished: Rates And Derivatives — Prometheus Certified Associate (PCA) Exam Prep