PromQL rate(), irate() and increase() turn counters into per-second rates or totals
Answer: Use rate(counter[5m]) for the per-second average rate of increase over a range, irate() for the per-second instant rate based on the last two data points, and increase() for the total increase in the range. Each of them should only be used with counters.
Examples
rate(http_requests_total{job="api-server"}[5m])
irate(http_requests_total{job="api-server"}[5m])
increase(http_requests_total{job="api-server"}[5m])
How they behave
rate(v range-vector)computes the per-second average rate of increase for each series in the range vector. Counter resets due to target restarts and other breaks in monotonicity are adjusted for automatically.ratealso extrapolates to the ends of the time range, which allows for missed scrapes or imperfect alignment of scrape cycles with the range.irate(v range-vector)gives the per-second instant rate of increase, based on the last two data points, looking back up to the range for the two most recent samples.increase(v range-vector)is syntactic sugar forrate(v)multiplied by the number of seconds under the time range window.
Gauges are different
idelta should only be used with gauges. Elements that mix float samples and histogram samples in the range are omitted from the result and flagged by a warn-level annotation.
See also
Claims
- id: C1 claim: rate calculates the per-second average rate of increase. source: S2 evidence: "calculates the per-second average rate of increase of the time series in the range vector"
- id: C2 claim: irate is based on the last two data points. source: S2 evidence: "This is based on the last two data points."
- id: C3 claim: increase is syntactic sugar for rate times the window seconds. source: S2 evidence: "It is syntactic sugar for
rate(v)multiplied by the number of seconds"
- id: C4 claim: idelta should only be used with gauges. source: S1 evidence: "should only be used with gauges"
Sources
- [S1] Query functions. Prometheus docs. https://prometheus.io/docs/prometheus/latest/querying/functions/ . License: Apache-2.0. Accessed 2026-11-18.
- [S2] Query functions (source page). prometheus/prometheus (GitHub). https://github.com/prometheus/prometheus/blob/main/docs/querying/functions.md . License: Apache-2.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Prometheus docs, Query functions; prometheus/prometheus (GitHub), Query functions (source page). Apache-2.0 (https://raw.githubusercontent.com/prometheus/prometheus/main/LICENSE). Copyright The Prometheus Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Prometheus docs, Query functions; prometheus/prometheus (GitHub), Query functions (source page). Apache-2.0 (https://raw.githubusercontent.com/prometheus/prometheus/main/LICENSE). Copyright The Prometheus Authors.
Cite this
iinventedlight. 2026. "PromQL rate(), irate() and increase() turn counters into per-second rates or totals." iinventedlight Library, iil:note:czkzn09z, version of 2026-11-18. https://iinventedlight.com/library/notes/prometheus-rate-increase/. License: CC-BY-4.0.
@misc{iil_note_czkzn09z,
author = {{iinventedlight}},
title = {{PromQL rate(), irate() and increase() turn counters into per-second rates or totals}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/prometheus-rate-increase/},
note = {Permanent ID iil:note:czkzn09z. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- prometheus-rate-increase.table.json (table; CC-BY-4.0)
- prometheus-rate-increase.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/prometheus-rate-increase.md.