There are a couple of things to unwrap here.

First, rate vs irate. Neither the linked question, nor the blog post address this (but Eitan's answer does touch on it). The difference is that rate estimates the average rate over the requested range (1 minute, in your case) while irate computes the rate based on the last 2 samples only. Leaving aside the "estimate" part (see this answer if you're curious) the practical difference between the 2 is that rate will smooth out the result, whereas irate will return a sampling of CPU usage, which is more likely to show extremes in CPU usage but also more prone to aliasing.

E.g. if you look at Prometheus' CPU usage, you'll notice that it's at a somewhat constant baseline, with a spike every time a large rule group is evaluated. Given a time range that was at least as long as Prometheus' evaluation interval, if you used rate you'd get a more or less constant CPU usage over time (i.e. a flat line). With irate (assuming a scrape interval of 5s) you'd get one of 2 things:

  1. if your resolution (i.e. step) was not aligned with Prometheus' evaluation interval (e.g. the resolution was 1m and the evaluation interval was 13s) you'd get a random sampling of CPU usage and would hopefully see values close to both the highest and lowest CPU usage over time on a graph;
  2. if your resolution was aligned with Prometheus' evaluation interval (e.g. 1m resolution and 15s evaluation interval) then you'd either see the baseline CPU usage everywhere (because you happen to look at 5s intervals set 1 minute apart, when no rule evaluation happens) or the peak CPU usage everywhere (because you happen to look at 5s intervals 1 minute apart that each cover a rule evaluation).

Regarding the second point, the apparent confusion over what the node_cpu_seconds_total metric represents, it is a counter. Meaning it's a number that increments continuously and essentially measures the amount of time the CPU was idle since the exporter started. The absolute value is not all that useful (as it depends on when the exporter started and will drop to 0 on every restart). What's interesting about it is by how much it increased over a period of time: from that you can compute for a given period of time a rate of increase per second (average, with rate; instant, with irate) or an absolute increase (with increase). So both rate(node_cpu_seconds_total{mode="idle"}[1m]) and irate(node_cpu_seconds_total{mode="idle"}[1m]) will give you a ratio (between 0.0 and 1.0) of how much the CPU was idle (over the past minute, and respectively between the last 2 samples).

Answer from Alin Sînpălean on Stack Overflow
🌐
Medium
medium.com › @bhupender.rawat4 › demystifying-prometheus-a-deep-dive-into-rate-and-irate-ce02745231fc
Demystifying Prometheus: A Deep Dive into rate() and irate() | by Bhupender Singh Rawat | Medium
May 7, 2025 - Given that we specified a [5m] interval and the scrape interval is 15 seconds, Prometheus will return 20 samples per time series, because: 5 minutes = 300 seconds 300 seconds / 15 seconds (scrape interval) = 20 samples · Understanding this structure is essential for correctly interpreting how rate() and irate() calculate the rate of change over time.
🌐
Reddit
reddit.com › r/prometheusmonitoring › irate() vs rate() functions in prometheus
r/PrometheusMonitoring on Reddit: irate() Vs rate() Functions in Prometheus
February 4, 2020 -

Hi All,

I'm trying to understand how irate() & rate() functions work. Why does irate() produce a similar looking graph when the range / resolution is 24h or 5m ? While the difference in graph is clearly visible with rate() when using range as 24h (presents a smoothed out line) or 5m(more spikey).

In the below graph for irate() for 2 different resolutions the graph looks the same. As per prometheus docs irate() calculates the per second instant rate based on the last two data points. What does this mean if my range is 24h? Thank you.

https://preview.redd.it/08mc4pq2mye41.jpg?width=3206&format=pjpg&auto=webp&s=4aef0b681969c8b9831ec0f34310838511ea0350

Need help with CPU usage alert Mar 22, 2020
r/PrometheusMonitoring
6y ago
Prometheus query to calculate a ratio between two series Jan 19, 2024
r/PrometheusMonitoring
2y ago
How can I understand rate() ? Nov 21, 2021
r/grafana
4y ago
Help me understand this metric behaviour May 6, 2025
r/PrometheusMonitoring
last yr.
More results from reddit.com
Discussions

Why is CPU utilization calculated using irate or rate in Prometheus? - Stack Overflow
I know that CPU utilization is given by the percentage of non-idle time over the total time of CPU. In Prometheus, rate or irate functions calculate the rate of change in a vector array. People o... More on stackoverflow.com
🌐 stackoverflow.com
rate vs irate for container_cpu_usage_seconds_total
Which component are you using? recommender Question At this point https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/pkg/recommender/input/history/history_provider.go#L274 Why rate is used instead of irate? hist... More on github.com
🌐 github.com
7
February 9, 2023
Rate and irate display very different values
Hello, I’ve got the two following sentences on two different graphs: rate(node_disk_bytes_read{job=“node_exporter”}[5m]) irate(node_disk_bytes_read{job=“node_exporter”}[5m]) The unit is bytes. As you can see in the attached image, on one graph the maximum reaches almost 12MiB, whereas ... More on community.grafana.com
🌐 community.grafana.com
4
1
April 4, 2018
irate() Vs rate() Functions in Prometheus

Let’s say you have a counter with these values observed at 1m intervals:

0
60
120
600
720
780

Now rate over 5m will be:

(780-0)/5/60 = 2.6/sec

And irate over 5m will be (only last two data points are used which happen to be only 1m apart)

(780-720)/1/60 = 1/sec

Increasing the resolution does not affect the irate function because the last two observed values do not change when you look further back.

More on reddit.com
🌐 r/PrometheusMonitoring
9
12
February 4, 2020
People also ask

How does the Prometheus rate() function differ from increase()?
While rate() calculates the per-second average rate of increase, increase() calculates the total increase in the counter's value over the time range. rate() is generally more useful for ongoing monitoring, while increase() can help understand total change over a specific period.
🌐
last9.io
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
Can rate() be used with all types of Prometheus metrics?
No, rate() should only be used with counter-metrics. It doesn't make sense to use rate() with gauge metrics, as they don't represent cumulative values.
🌐
last9.io
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
How do you calculate request rates using the Prometheus rate function?
To calculate request rates, use a query like rate(http_requests_total[5m]). This will give the per-second rate of requests over the last 5 minutes. These rates can be summed or grouped as needed, e.g., sum(rate(http_requests_total[5m])) for the total request rate across all instances.
🌐
last9.io
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
🌐
Last9
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
June 15, 2026 - Prometheus offers two functions for calculating rates from counter metrics, each with distinct purposes: rate(): Calculates the per-second average rate over the entire time range, smoothing out fluctuations. irate(): Calculates the instantaneous ...
🌐
Tech Annotation
techannotation.wordpress.com › 2021 › 07 › 19 › irate-vs-rate-whatre-they-telling-you
irate() vs rate() – What're they telling you? - Tech Annotation
July 22, 2021 - It depends on what you’re going to show and what you want to highlight. irate() is more susceptible to data variations, while rate() gives us an overall traffic trend of our application.
🌐
DevOps.dev
blog.devops.dev › prometheus-theory-rate-vs-irate-20e6243a3ab8
[Prometheus Theory] rate() vs. irate() | by - DevOps.dev
October 26, 2023 - ... The rate() function would average using the first and last data points, averaged over the query interval (1m); whereas the irate() function would average using the last two data points, averaged over the scrape interval (15s).
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
irate should only be used when graphing volatile, fast-moving counters. Use rate for alerts and slow-moving counters, as brief changes in the rate can reset the FOR clause and graphs consisting entirely of rare spikes are hard to read.
Find elsewhere
🌐
Medium
medium.com › @kavyaprathyusha › rate-vs-irate-in-promql-a172e3d9c38f
rate() vs irate() in promQL - by Kavya Prathyusha Chekka
August 16, 2021 - rate() is generally used when graphing the slow moving counters. While irate() is used when graphing the high volatile counters. Hope this post helps someone! :) Prometheus · Alerting · Promql · 14 followers · ·34 following · Help · Status ...
🌐
PagerTree
pagertree.com › learn › prometheus › promeql › counter rates & increases
Counter Rates & Increases | PagerTree
rate() - "rate of increase" - calculates a per-second increase of a counter as averaged over a specified window. ... irate() - "instantaneous rate of increase" - calculates a per-second increase over the time window, only considering the last ...
🌐
Chris's Wiki
utcc.utoronto.ca › ~cks › space › blog › sysadmin › PrometheusRateVsIrate
rate() versus irate() in Prometheus (and Grafana)
November 5, 2018 - Three out of every four metric points collected by Prometheus are actually the same thing; only every fourth one represents a genuine new data point. Similar things can happen with metrics scraped from Pushgateway.) Obviously, the difference between rate() and irate() basically vanish when the range interval gets sufficiently small.
Top answer
1 of 2
25

There are a couple of things to unwrap here.

First, rate vs irate. Neither the linked question, nor the blog post address this (but Eitan's answer does touch on it). The difference is that rate estimates the average rate over the requested range (1 minute, in your case) while irate computes the rate based on the last 2 samples only. Leaving aside the "estimate" part (see this answer if you're curious) the practical difference between the 2 is that rate will smooth out the result, whereas irate will return a sampling of CPU usage, which is more likely to show extremes in CPU usage but also more prone to aliasing.

E.g. if you look at Prometheus' CPU usage, you'll notice that it's at a somewhat constant baseline, with a spike every time a large rule group is evaluated. Given a time range that was at least as long as Prometheus' evaluation interval, if you used rate you'd get a more or less constant CPU usage over time (i.e. a flat line). With irate (assuming a scrape interval of 5s) you'd get one of 2 things:

  1. if your resolution (i.e. step) was not aligned with Prometheus' evaluation interval (e.g. the resolution was 1m and the evaluation interval was 13s) you'd get a random sampling of CPU usage and would hopefully see values close to both the highest and lowest CPU usage over time on a graph;
  2. if your resolution was aligned with Prometheus' evaluation interval (e.g. 1m resolution and 15s evaluation interval) then you'd either see the baseline CPU usage everywhere (because you happen to look at 5s intervals set 1 minute apart, when no rule evaluation happens) or the peak CPU usage everywhere (because you happen to look at 5s intervals 1 minute apart that each cover a rule evaluation).

Regarding the second point, the apparent confusion over what the node_cpu_seconds_total metric represents, it is a counter. Meaning it's a number that increments continuously and essentially measures the amount of time the CPU was idle since the exporter started. The absolute value is not all that useful (as it depends on when the exporter started and will drop to 0 on every restart). What's interesting about it is by how much it increased over a period of time: from that you can compute for a given period of time a rate of increase per second (average, with rate; instant, with irate) or an absolute increase (with increase). So both rate(node_cpu_seconds_total{mode="idle"}[1m]) and irate(node_cpu_seconds_total{mode="idle"}[1m]) will give you a ratio (between 0.0 and 1.0) of how much the CPU was idle (over the past minute, and respectively between the last 2 samples).

2 of 2
0

Looks like this is already answered here: Prometheus - Convert cpu_user_seconds to CPU Usage %? Looking at the provided link in the answers: https://www.robustperception.io/understanding-machine-cpu-usage you can see the explanation. Personally, I think that irate in this context makes more sense, as it will show you the average on the last active points (vs. rate which will average the entire sampled timeslot).

🌐
MetricFire
metricfire.com › blog › understanding-the-prometheus-rate-function
How the Prometheus rate() function works | MetricFire
March 12, 2026 - The nice thing about the rate() function is that it considers all data points, not just the first and last ones. Another function, irate, uses only the first and last data points.
🌐
Sean's Blog
tsaisean.github.io › tech › 2021-12-21-prometheus-what-is-the-difference-between-rate-and-irate
[Prometheus] What is the difference between rate and irate | | Sean's Blog
# Element {code=”200",handle... the equation taking the last two metric points: ... irate should only be used when graphing volatile, fast-moving counters....
🌐
Medium
medium.com › @rameshavutu › prometheus-rate-irate-increase-counters-gauges-explained-2e4a0eeedfa3
Prometheus rate() vs irate() vs increase(): Understanding Counters, Gauges, and Accurate Metrics | Medium
June 10, 2026 - The most important branch: don’t apply rate() or irate() to a gauge. It produces results that look numeric but are meaningless. Memory usage doesn't have a "rate of increase per second" in the same sense. what you want is the current value or maybe a delta, not a rate. When a Prometheus-instrumented process restarts, its in-process counters reset to zero.
🌐
Medium
medium.com › @marcoghisellini › irate-vs-rate-whatre-they-telling-you-91ab0645a892
irate() vs rate() — What’re they telling you? | by Marco Ghisellini | Medium
December 23, 2021 - It depends on what you’re going ... irate() is more susceptible to data variations, while rate() gives us an overall traffic trend of our application. As you’ve seen, the range interval play an important role in this calc.
🌐
Robust Perception
robustperception.io › irate-graphs-are-better-graphs
Irate graphs are better graphs – Robust Perception | Prometheus Monitoring Experts
October 17, 2015 - Due to the instant rate being more responsive, there are a few things you should be aware of. If you're doing alerting based on irate a very brief dip could reset the alert's FOR clause, so prefer rate for alerting.
🌐
Medium
mohansaiteki.medium.com › manually-calculate-the-rate-irate-and-increase-functions-in-prometheus-7e755fff9897
Manually calculate the rate, irate, and increase functions in Prometheus
August 21, 2023 - Prometheus output is the same as ours. So we successfully calculated the rate function manually. ... starting value in timerange (v2) - next occurance value in timerange (v1) rate = ----------------------------------------------------------...
🌐
Promlabs
promlabs.com › blog › 2021 › 01 › 29 › how-exactly-does-promql-calculate-rates
PromLabs | Blog - How Exactly Does PromQL Calculate Rates?
January 29, 2021 - This function is the most common, ... unit. irate() ("instant rate"): This calculates the rate of increase per second just like rate(), but only considers the last two samples under the provided time window for the calculation and ignores all earlier ones...
🌐
GitHub
github.com › kubernetes › autoscaler › issues › 5490
rate vs irate for container_cpu_usage_seconds_total · Issue #5490 · kubernetes/autoscaler
February 9, 2023 - Why rate is used instead of irate? historicalCpuQuery := fmt.Sprintf("rate(container_cpu_usage_seconds_total{%s}[%s])", podSelector, p.config.HistoryResolution) https://prometheus.io/docs/prometheus/latest/querying/functions/#rate · https://prometheus.io/docs/prometheus/latest/querying/functions/#irate ·
Author: kubernetes
🌐
Medium
valyala.medium.com › why-irate-from-prometheus-doesnt-capture-spikes-45f9896d7832
Why irate from Prometheus doesn't capture spikes | by Aliaksandr Valialkin | Medium
November 17, 2021 - If in doubt, prefer rate over irate, since rate consistently returns average per-second rate values for the given [range], while irate usually returns a random set of per-second rate values, which may look like garbage for volatile fast-moving ...
🌐
Grafana
community.grafana.com › prometheus
Rate and irate display very different values - Prometheus - Grafana Labs Community Forums
April 4, 2018 - Hello, I’ve got the two following sentences on two different graphs: rate(node_disk_bytes_read{job=“node_exporter”}[5m]) irate(node_disk_bytes_read{job=“node_exporter”}[5m]) The unit is bytes. As you can see in the …