The "increase" function calculates how much some counter has grown and the "rate" function calculates the amount per second the measure grows.

Analyzing your data I think you used [30s] for the "increase" and [1m] for the "rate" (the correct used values are important to the result).

Basically, for example, in time 2m we have:

increase[30s] = count at 2m - count at 1.5m = 4423 - 4402 = 21
rate[1m]      = (count at 2m - count at 1m) / 60 = (4423 - 4381) / 60 = 0.7

Prometheus documentation: increase and rate.

Answer from Marcelo Ávila de Oliveira on Stack Overflow
🌐
MetricFire
metricfire.com › blog › understanding-the-prometheus-rate-function
How the Prometheus rate() function works | MetricFire
March 12, 2026 - You can also get a free trial and check it out now. In Prometheus's query language, PromQL, the rate() function is used to determine the average per-second rate of increase of a counter metric over a given time range.
Top answer
1 of 3
24

The "increase" function calculates how much some counter has grown and the "rate" function calculates the amount per second the measure grows.

Analyzing your data I think you used [30s] for the "increase" and [1m] for the "rate" (the correct used values are important to the result).

Basically, for example, in time 2m we have:

increase[30s] = count at 2m - count at 1.5m = 4423 - 4402 = 21
rate[1m]      = (count at 2m - count at 1m) / 60 = (4423 - 4381) / 60 = 0.7

Prometheus documentation: increase and rate.

2 of 3
15

Prometheus calculates rate(count[d]) at timestamp t in the following way:

  1. It obtains raw samples per each time series with count name on the time range (t-d ... t]. Note that t-d timestamp isn't included in the range, while t timestamp is included in the range. For example, when calculating rate(count[1m]) at a timestamp t=2m the following raw samples are selected: 4423 @ 2m, 4402 @ 1m45s, 4402 @ 1m30s, 4381 @ 1m15s. Note that the 4381 @ 1m sample isn't included in calculations.
  2. Then it calculates the difference between the last and the first sample on the selected time range per each time series with the name count. Prometheus can detect and remove time series resets to zero on the selected time range, but let's skip this for now for the sake of clarity. In the case above it calculates 4423 @ 2m - 4381 @ 1m15s = 42.
  3. Then it divides results from step 2 by the duration d in seconds per each time series with name count. In the case above it calculates 42 / 1m = 42 / 60s = 0.7.

The actual result for rate(count[1m]) @ 2m - 0.700023 - differs from the calculated result - 0.7 - because of extrapolation, which can be applied to results calculated at step 2 if timestamps for the first and/or the last raw sample are located too far from the selected time range bounds. See more details about the extrapolation in this issue.

Note also that Prometheus misses possible counter increase on the time range [1m ... 1m15s] when calculating both rate() and increase(). See more details about this issue here and here.

Discussions

Do I understand Prometheus's rate vs increase functions correctly? - Stack Overflow
Then the rate is calculated by dividing the extrapolated increase by d. Prometheus calculates increase(counter[d]) in the same way except the last step. Let's look at a few examples applied to the original data: More on stackoverflow.com
🌐 stackoverflow.com
Sum rate with missing values?
In the query, no. I would create a recording rule that would show the value or 0, and then rate on that. However, if the server is down, a value of 0 is not accurate -- you didn't process 0 transactions, but rather you processed inf transactions. You really can't say what happened during that time. Why are missing metrics preventing you from capturing that rate? The rate function should account for resets and missing data. More on reddit.com
🌐 r/PrometheusMonitoring
4
3
April 20, 2022
Calculating the Avg with Gaps in Data
I've had to do this for work multiple times and Prometheus isn't the correct tool unfortunately. It isn't made to store high cardinality fields like IP addresses. As you're using sFlow, this is more log-based and OLAP databases are more appropriate. But trying to answer your question: avg_over_time((sflow_asn_bps OR on() vector(0) )[10h]) and taking the instant value (haven't tested it but you'd complete the timeseries with zero values then doing the average) would summing sum_over_time and dividing by 10 hours work? More on reddit.com
🌐 r/PrometheusMonitoring
4
2
November 29, 2024
Min, max, avg, and stddev of values in between scrape interval
I think you may be misunderstanding of how Prometheus is designed. It doesn't "hide" values between the scrape interval. It never records them in the first place. The node_cpu_seconds_total metric is a counter. It records the amount of "busy" time for the CPU since the counter last reset, which happens when the node_exporter restarts or if the counter rolls over at the maximum possible value. You can use that metric with rate() or irate() to approximate a "percentage" CPU usage across the scrape interval. Here's an old blog post about it . If an average across 30 seconds isn't sufficient for your use case then you can decrease the scrape interval (possibly only for CPU metrics, by creating a separate job definition) or consider some different tooling. Information on using Prometheus to monitor basic system metrics is quite abundant at this point so I'd highly recommend looking around for some guides or documentation. Googling for "node_cpu_seconds_total" will have turned up both that blog post and the official documentation, which includes a note about how to use that metric . More on reddit.com
🌐 r/PrometheusMonitoring
12
5
April 22, 2023
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
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
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
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
The info function not only resolves ... labels are. The example query looks like this with the info function: info( rate(http_server_request_duration_seconds_count[2m]), {k8s_cluster_name=~".+"} )...
🌐
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 - Think of it as a smooth operator—it doesn’t care about small spikes or sudden changes, it just tells you the general trend. When you write something like rate(http_requests_total[5m]), you're asking Prometheus: “Hey, what’s the average ...
🌐
Last9
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
June 15, 2026 - This ensures enough data points for accurate calculations while smoothing out irregularities. For example, if your scrape interval is 15 seconds, your time range should be at least 1 minute (rate(counter[1m])).
🌐
Promlabs
promlabs.com › blog › 2021 › 01 › 29 › how-exactly-does-promql-calculate-rates
PromLabs | Blog - How Exactly Does PromQL Calculate Rates?
January 29, 2021 - The following example diagram shows how a rate() calculation deals with a counter reset happening under the provided window. You can imagine this as rate() creating a set of "virtual" samples from the underlying "real" samples.
Find elsewhere
🌐
Medium
mopitz.medium.com › understanding-prometheus-rate-function-15e93e44ae61
Understanding Prometheus Rate Function | by Mopitz | Medium
June 21, 2021 - To do so, we are going to use the rate() function. So if our metric name is(eg): ... Let’s go by parts. The [1m] means that we are going to group all our points(according to the scrapper time that we set in prometheus) in a group of 1 minute.
🌐
Medium
medium.com › @MetricFire › how-the-prometheus-rate-function-works-cc63fe90ef19
How the Prometheus rate() function works | by MetricFire | Medium
July 31, 2023 - Optionally, you apply rate() only to certain dimensions just like with other functions. For example, rate(foo) by (bar) will calculate the rate of change of foo for every bar (label’s name).
🌐
MetricFire
metricfire.com › blog › what-is-prometheus-rate
What is Prometheus rate? | MetricFire
May 14, 2025 - MetricFire offers this to help your company predict trends and increase functionality. If you'd like to try our Prometheus alternative for yourself, sign up today for a free trial of our Hosted Graphite or sign up for a demo. The Prometheus rate function is the process of calculating the average per second rate of value increases.
🌐
SigNoz
signoz.io › guides › what is the difference between prometheus rate vs increase functions
Prometheus rate vs increase Functions Explained | SigNoz
June 23, 2026 - Rate() calculates per-second average change; increase() shows total change over time. Both functions are essential for analyzing counter metrics in Prometheus.
🌐
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 - Now without wasting time let’s ... (t1) rate function considers the start and end values in a given time range and divides them with no of seconds, which gives us the rate of change of value per second....
🌐
OneUptime
oneuptime.com › home › blog › how to understand rate() vs increase() in prometheus
How to Understand rate() vs increase() in Prometheus
December 17, 2025 - Both functions handle counter resets (when the counter goes back to zero after a restart): sequenceDiagram participant C as Counter participant P as Prometheus C->>P: Value: 100 C->>P: Value: 150 Note right of P: Normal increase: 50 C->>P: Value: 200 Note right of P: Normal increase: 50 C->>P: Value: 0 (restart) C->>P: Value: 30 Note right of P: Detects reset, adds<br/>post-reset increase · # Counter values: 100, 150, 200, 0 (reset), 30 # rate() and increase() detect the drop from 200 to 0 # They add the post-reset increase to the pre-reset increases # The resets() function shows how many resets occurred resets(http_requests_total[1h])
🌐
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).
🌐
DoHost
dohost.us › home › 2025 › september › 28 › understanding rate vs. increase in promql
Understanding Rate vs. Increase in PromQL - DoHost
September 28, 2025 - Example: rate(http_requests_total[5m]) calculates the average rate of HTTP requests per second over the last 5 minutes. The increase() function calculates the increase in the time series over the specified time range.
Top answer
1 of 3
273

In an ideal world (where your samples' timestamps are exactly on the second and your rule evaluation happens exactly on the second) rate(counter[1s]) would return exactly your ICH value and rate(counter[5s]) would return the average of that ICH and the previous 4. Except the ICH at second 1 is 0, not 1, because no one knows when your counter was zero: maybe it incremented right there, maybe it got incremented yesterday, and stayed at 1 since then. (This is the reason why you won't see an increase the first time a counter appears with a value of 1 -- because your code just created and incremented it.)

increase(counter[5s]) is exactly rate(counter[5s]) * 5 (and increase(counter[2s]) is exactly rate(counter[2s]) * 2).

Now what happens in the real world is that your samples are not collected exactly every second on the second and rule evaluation doesn't happen exactly on the second either. So if you have a bunch of samples that are (more or less) 1 second apart and you use Prometheus' rate(counter[1s]), you'll get no output. That's because what Prometheus does is it takes all the samples in the 1 second range [now() - 1s, now()] (which would be a single sample in the vast majority of cases), tries to compute a rate and fails.

If you query rate(counter[5s]) OTOH, Prometheus will pick all the samples in the range [now() - 5s, now] (5 samples, covering approximately 4 seconds on average, say [t1, v1], [t2, v2], [t3, v3], [t4, v4], [t5, v5]) and (assuming your counter doesn't reset within the interval) will return (v5 - v1) / (t5 - t1). I.e. it actually computes the rate of increase over ~4s rather than 5s.

increase(counter[5s]) will return (v5 - v1) / (t5 - t1) * 5, so the rate of increase over ~4 seconds, extrapolated to 5 seconds.

Due to the samples not being exactly spaced, both rate and increase will often return floating point values for integer counters (which makes obvious sense for rate, but not so much for increase).

2 of 3
50

Prometheus calculates rate(counter[d]) at timestamp t in the following way:

  1. It selects raw samples for the counter time series on the time range (t-d ... t]. Note that the t-d timestamp isn't included in the time range, while t timestamp is included in the time range. If the selected time range contains less than two raw samples, then Prometheus returns an empty value (a gap) at the timestamp t.
  2. Then it calculates the increase of the selected raw samples. Usually it is calculated as the difference between the last selected sample and the first selected sample. Calculations become slightly complicated if the counter was reset to zero during the selected time range. Let's skip this for the sake of clarity.
  3. Then the resulting increase can be extrapolated if timestamps for the first and/or the last raw samples are located too far from the bounds of the selected time range.
  4. Then the rate is calculated by dividing the extrapolated increase by d.

Prometheus calculates increase(counter[d]) in the same way except the last step.

Let's look at a few examples applied to the original data:

second   counter_value    increase calculated by hand(call it ICH from now)
1             1                    1
2             3                    2
3             6                    3
4             7                    1
5            10                    3
6            14                    4
7            17                    3
8            21                    4
9            25                    4
10           30                    5
  • The rate(counter[1s]) will return nothing at any timestamp t, since any time range (t-1s ... t] contains only a single raw sample, while Prometheus requires at least two samples for calculating both rate() and increase().

  • The rate(counter[2s]) and increase(counter[2]) would return the following values per each timestamp t when extrapolation isn't applied:

t       counter_value    rate(counter[2s])        increase(counter[2s])
1             1                    -                       -
2             3               (3-1)/2=1.0                3-1=2
3             6               (6-3)/2=1.5                6-3=3
4             7               (7-6)/2=0.5                7-6=1
5            10              (10-7)/2=1.5               10-7=3
6            14             (14-10)/2=2                14-10=4
7            17             (17-14)/2=1.5              17-14=3
8            21             (21-17)/2=2                21-17=4
9            25             (25-21)/2=2                25-21=4
10           30             (30-25)/2=2.5              30-25=5

In reality Prometheus results for rate(counter[2s]) and increase(counter[2s]) may be slightly bigger because of extrapolation, since the first sample on the selected time range is located comparatively far from the start of the time range.

Such calculations have the following issues:

  • Prometheus can return fractional results from increase() over time series, which contains only integer values. This is because of extrapolation. For example, Prometheus may return fractional results from increase(http_requests_total[5m]).

  • Prometheus returns empty results (aka gaps) from increase(counter[d]) and rate(counter[d]) when the lookbehind window d doesn't cover at least two samples - see rate(counter[1s]) and increase(counter[1s]) example above.

  • Prometheus completely misses the increase between the raw sample just before the (t-d ... t] interval and the first raw sample on this interval. This may result in inaccurate calculations. For example, increase(counter[1h]) doesn't equal to sum_over_time(increase(counter[1m])[1h:1m]).

Prometheus developers are aware of these issues - see this link. These issues are addressed in the system I work on - VictoriaMetrics - more specifically, in MetricsQL query language - see this comment and this article for technical details.

🌐
DoiT
doit.com › home › blog › making peace with prometheus rate()
Making peace with Prometheus rate() | DoiT
February 17, 2023 - This is a fork of Prometheus that adds xrate(), xincrease(), etc. functions that both add extra scrape (similar to as $__rate_interval will do) but will also apply de-extrapolation as we did in the last chapter example:
🌐
Google Groups
groups.google.com › g › prometheus-developers › c › VYaiXJCsHxQ
How to rate() calculated
> 2) Don't understand why example ... > > rate(http_request_duration_seconds_sum[5m]) > / > rate(http_request_duration_seconds_count[5m]) > > correct > > (a)http_request_duration_seconds_sum[5m] -- is a growing sum of request duration over last 5m, > rate(a) -- average value of request duration per second over last 5m...
🌐
Medium
medium.com › the-metricfire-blog › understanding-the-prometheus-rate-function-6bfa8d8fd4b5
Understanding the Prometheus rate() function | by MetricFire | The MetricFire Blog | Medium
April 26, 2023 - Optionally, you apply rate() only to certain dimensions just like with other functions. For example, rate(foo) by (bar) will calculate the rate of change of foo for every bar (label’s name).
🌐
Medium
medium.com › @armanihsan224 › rate-and-increase-function-in-promql-235bba167000
rate and increase function in promQL | by Arman ihsan | Apr, 2026 | Medium
April 12, 2026 - All three functions operate on the same principle: The Core Formula · Change = Current Value — Past Value · The Data They Need · They all require a range vector [time] — a time window to look back. promql · # The [1m] tells Prometheus “look back 1 minute” · rate(metric_name[1m]) increase(metric_name[1m]) irate(metric_name[1m]) The Raw Data Example ·