delta will fail when your counter will be reset (when it will start counting from 0 again), while increase/rate will detect that and adjust result accordingly. So with:

t0: 5
t1: 11
t2: 28
t3: 4
t4: 40

with delta you'll probably get 40 - 5 = 35, while increase will probably calculate something similar to (28-5)+40 = 63

Answer from bjakubski on Stack Overflow
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
Elements in v where one of the ... idelta should only be used with gauges (for both floats and histograms). increase(v range-vector) calculates the increase in the time series in the range vector....
Discussions

Proposal for improving rate, increase, delta (based on xrate, xincrease)
Proposal Building on the excellent work of Alin Sinpalean discussed in #3806 and #12386, I would like to propose a variation that makes these improvements: results are linear (meaning that the sum ... More on github.com
🌐 github.com
13
October 11, 2023
Incorrect handling of metrics by the delta() function in Grafana
I am using prometheus-cpp library , Prometheus v2.34, Grafana v8.4.5 and operating system Windows 10. And I want to calculate the intensity of my application. This application processes files. I count the processing time of each file and send it to Prometheus as a counter.Increment(Processed_time). More on community.grafana.com
🌐 community.grafana.com
2
0
May 22, 2022
Do I understand Prometheus's rate vs increase functions correctly? - Stack Overflow
I have read the Prometheus documentation carefully, but its still a bit unclear to me, so I am here to get confirmation about my understanding. (Please note that for the sake of the simplest examples More on stackoverflow.com
🌐 stackoverflow.com
Increase/Delta/Rate functions
I am using prometheus 1.5.1 and having some issues regarding some functions and their documentation. First of all, It would be really nice to demonstrate some examples in the documentation. It is r... More on github.com
🌐 github.com
4
April 18, 2017
🌐
GitHub
github.com › prometheus › prometheus › discussions › 13900
inconsistency in prometheus rate/increase/deriv/delta calculation · prometheus/prometheus · Discussion #13900
April 6, 2024 - Hi , While reviewing Prometheus-related content online, I've come to understand that the rate / deriv is calculated as (v2 - v1) / (t2 - t1), and the increase/delta is simply (v2 - v1). Now, co...
Author: prometheus
🌐
ADHDecode
adhdecode.com › articles › prometheus › prometheus-increase-vs-delta-functions
Prometheus increase() vs delta(): Use the Right Function (2026) | ADHDecode
If the counter has never been seen before, increase() will return 0. It needs at least two data points to calculate an increase. This is usually not an issue in practice as Prometheus typically scrapes metrics regularly, providing multiple points. The most common mistake is using delta() when you should be using increase().
🌐
Grokipedia
grokipedia.com › increase and delta functions (prometheus)
Increase and delta functions (Prometheus) — Grokipedia
January 14, 2026 - This checklist aligns with Prometheus ... query construction.[2] The choice between increase() and delta() significantly impacts alerting accuracy, as mismatched usage can lead to skewed thresholds....
🌐
Google Groups
groups.google.com › g › prometheus-users › c › Naa9PzAUvis
delta in promql vs Grafana delta on dashboard
July 1, 2023 - Use `$__rate_interval` to make sure you get enough samples for `delta()` to work. (delta(), rate(), increase(), function similarly). ... To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/63cf733e-87bd-4530-9531-5a3a29556d8an@googlegroups.com.
🌐
GitHub
github.com › prometheus › prometheus › issues › 12967
Proposal for improving rate, increase, delta (based on xrate, xincrease) · Issue #12967 · prometheus/prometheus
October 11, 2023 - Here is a Design Doc with a detailed explanation including examples: Prometheus yrate (yrate, yincrease, ydelta): Linear versions of rate(), increase() and delta(), based on xrate() We have been running a fork of Prometheus (and Thanos) for about 6 months now that has these improvements and it has been working great for us.
Author: prometheus
🌐
Chris's Wiki
utcc.utoronto.ca › ~cks › space › blog › sysadmin › PrometheusDeltaVsOffset
Chris's Wiki :: blog/sysadmin/PrometheusDeltaVsOffset
March 24, 2019 - You can't replace an increase() with an offset unless you're willing to ignore any errors caused by counter resets. If you're doing ad-hoc queries, you probably need to narrow down the number of metric points you're trying to load by using labels and so on. And if you really want to know, say, the average interface bandwidth for a specific network interface over an entire year, you may be plain out of luck until you put more RAM in your Prometheus server and increase its query limits.)
Find elsewhere
🌐
Medium
medium.com › @texasdave2 › using-delta-in-prometheus-differences-over-a-period-of-time-c72a6182c426
Using delta in Prometheus, differences over a period of time | by David O'Dell | Medium
July 15, 2019 - We needed to have a way to count the number of restarts in the past hour, rather, if there was a difference in the number of restarts above some level in the last hour. That’s where DELTA comes in.
🌐
MetricFire
metricfire.com › blog › understanding-the-prometheus-rate-function
How the Prometheus rate() function works | MetricFire
March 12, 2026 - You might now say… why not delta()? Well, rate() we have just described has this excellent characteristic: it automatically adjusts for resets. This means it is only suitable for constantly increasing metrics, a.k.a.
🌐
Google Groups
groups.google.com › g › prometheus-users › c › PZ-fnZxSpOk
looks like rate/irate/delta/increase are not calculating consistent
January 28, 2021 - You can find the exact details ...rometheus/prometheus/blob/275f7e7766f80648d6e63ed968685f3963b494e9/promql/functions.go#L55-L131 · Short summary is: rate() / increase() will give you on-average decent approximation of the actual rate of increase by extrapolating to the window boundaries. ... I think rate/irate/delta/increase are ...
🌐
Google Groups
groups.google.com › g › prometheus-users › c › WvUYBfd4pPg
Delta only for gauges?
April 5, 2017 - delta() and deriv() are for gauges, as they don't interpret non-monotonically increasing values as resets. So you can see e.g. how much a temperature has changed in the last 1h, or see how disk usage is trending. ... -- You received this message because you are subscribed to the Google Groups ...
🌐
BytePlus
docs.byteplus.com › en › docs › vmp › Basic-PromQL-functions
PromQL common functions--Vital Managed Service for Prometheus-Byteplus
August 19, 2025 - Home Vital Managed Service for PrometheusBasic Prometheus knowledgePromQL quick startPromQL common functions
🌐
Reddit
reddit.com › r/prometheusmonitoring › [deleted by user]
[deleted by user] : r/PrometheusMonitoring
December 4, 2023 - Prometheus Monitoring subreddit · Members Online • · [deleted] Tiếng Việt · Share · Share · Sort by: Best · Open comment sort options · Best · Top · New · Controversial · Old · Q&A · SuperQue · • 2y ago · If you look at the documentation the delta() function also applies extrapolation to the data to fit the exact time window.
🌐
Promlabs
promlabs.com › blog › 2021 › 01 › 29 › how-exactly-does-promql-calculate-rates
PromLabs | Blog - How Exactly Does PromQL Calculate Rates?
January 29, 2021 - Note that we will only look at the above-mentioned counter-related functions here. If you want to track the increase or decrease of a gauge metric, you will need to use the delta() or deriv() functions for that instead.
🌐
Grafana
community.grafana.com › prometheus
Incorrect handling of metrics by the delta() function in Grafana - Prometheus - Grafana Labs Community Forums
May 22, 2022 - I am using prometheus-cpp library , Prometheus v2.34, Grafana v8.4.5 and operating system Windows 10. And I want to calculate the intensity of my application. This application processes files. I count the processing time of each file and send it to Prometheus as a counter.Increment(Processed_time).
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.

🌐
GitHub
github.com › prometheus › prometheus › issues › 2637
Increase/Delta/Rate functions · Issue #2637 · prometheus/prometheus
April 18, 2017 - I am experimenting prometheus and came across a case where numbers does not make sense. Scrape Interval: 30s Range duration: 60s (Every range vector contains 2 points for per serie) When I use increase function, I have results doubled. I mean actual difference is 5 but result is 10.
Author: prometheus
🌐
DoiT
doit.com › home › blog › making peace with prometheus rate()
Making peace with Prometheus rate() | DoiT
February 17, 2023 - At 13:14:15 increase() does report a change but… it’s bigger than the actual one! Namely, 1.33 instead of 1.0. Why? Back to chalkboard again: Prometheus extrapolation in action · You see, we have four data points in each bucket, but we need delta over time, remember, and time-wise our four data points only cover 45 seconds instead of 60!
🌐
GitHub
github.com › prometheus › prometheus › issues › 8413
looks like rate/irate/delta/increase are not calculating consistent · Issue #8413 · prometheus/prometheus
January 27, 2021 - What did you do? I have a counter series on a 30s (may be 15s - not 100% sure) scrape interval. On that series I query rate(). What did you expect to see? For a counter increase by 1 I expect a rate() result/value of 1/60 = 0.01666666666...
Author: prometheus