There are no interrelations between these two settings. For example, if rate(http_requests_total{job="api-server"}[5m]) is your PromQL query, it yields a single value when you execute it at a specific point in time. If you have a Grafana dashboard with a 2h time range, then Grafana just repeatedly executes this query at a series of point in times during the past 2 hours, and displays you the result of each query as e.g. a graph.

For example, if the time range of your Grafana dashboard is 2h and the interval is set to 1 minute, then Grafana executes your query 120 times during the time span ranging the past 2 hours. The results of all these queries form a graph and that's what you see in your Grafana dashboard.

The interval with which Grafana executes the query is determined by the Max data points and Min interval settings in the Query options of your Grafana dashboard:

See the explanations about these settings in the Grafana documentation.

Note: Grafana uses the query_range endpoint of the Prometheus API to repeatedly execute the query over the given time range.

Answer from weibeld on Stack Overflow
🌐
Last9
last9.io › blog › grafana-rate-function
Why Grafana's Rate Function Is Your Dashboard's Best Kept Secret | Last9
April 25, 2025 - For example, knowing you’ve served 10 million requests since your app started isn’t as useful as knowing you’re currently handling 200 requests per second. Getting started with the rate function is straightforward. Here’s the basic syntax to use in your Grafana queries:
🌐
Grafana
grafana.com › docs › k6 › latest › javascript-api › k6-metrics › rate
Rate | Grafana k6 documentation
For example: rate < 0.1 // less than 10% rate >= 0.9 // more or equal to 90% The value of the rate variable ranges between 0.00 and 1.00. JavaScript Copy · import { Rate } from 'k6/metrics'; const myRate = new Rate('my_rate'); export default ...
Discussions

What is the exact fomula of the funtion rate?
I use the folowing metrics : rate(fuelBurningTime{job=“Raspberry”}[$__rate_interval]) but i did not found in the documentation the exact calculation done by this rate function. Il mathematics I understand rate as dervative. But question is what is the interval used? is ther many point inside ... More on community.grafana.com
🌐 community.grafana.com
6
0
February 10, 2022
How can I understand rate() ?
So in your example, each point on the graph would be the rate in change over one minute, and the graph would show 3 hours worth of data points. More on reddit.com
🌐 r/grafana
4
3
November 21, 2021
Applying a rate function to positive and negative changes
I’ve set up a new graph in Grafana showing the change of a metric using the rate() function. However, it seems to work in inverse (showing a positive value when the gauge drops) and does not show any change when the gauge increases. I’ve plotted the original gauge (yellow, right axis) along ... More on community.grafana.com
🌐 community.grafana.com
1
1
June 22, 2018
Grafana / prometheus: understand rate function - Stack Overflow
Using Grafana to graph a simple timeline from prometheus: Why there is a such difference between rate and avg function? rate give point less then minimum value More on stackoverflow.com
🌐 stackoverflow.com
February 2, 2021
🌐
MetricFire
metricfire.com › blog › understanding-the-prometheus-rate-function
How the Prometheus rate() function works | MetricFire
March 12, 2026 - 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. It is particularly useful for understanding the behavior of metrics that are expected to increase monotonically, such as the total number of HTTP requests received by a server.Customizable Managed Grafana Dashboards
🌐
Grafana
community.grafana.com › prometheus
What is the exact fomula of the funtion rate? - Prometheus - Grafana Labs Community Forums
February 10, 2022 - I use the folowing metrics : rate(fuelBurningTime{job=“Raspberry”}[$__rate_interval]) but i did not found in the documentation the exact calculation done by this rate function. Il mathematics I understand rate as de…
🌐
Grafana
grafana.com › blog › 2020 › 09 › 28 › new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work
New in Grafana 7.2: \$\_\_rate_interval for Prometheus rate queries that just work | Grafana Labs
September 29, 2020 - Grafana helpfully tells us about ... see, the interval is only 15s. Our Prometheus server is configured with a scrape interval of 15s, so we should use a range of at least 1m in the rate query....
🌐
Reddit
reddit.com › r/grafana › how can i understand rate() ?
r/grafana on Reddit: How can I understand rate() ?
November 21, 2021 -

Hi everyone, I'm stupid. I can't figure out exactly how to interpret rate() in Prometheus.

node_network_transmit_bytes_total{} is just a counter. Use rate() for a rate. Got it.

rate(node_network_transmit_bytes_total{}[1m]) sounds like it should be interpreted as: "How many bytes were transmitted over a minute", but then there's the time range settings in the upper right. Would "Last 3 hours" mean, the average transmit rate per minute for the last 3 hours?

Basically, could someone explain what: rate(node_network_transmit_bytes_total{}[1m]) with a time range of "Last 3 hours" would indicate? None of the explanations I've found on blogs, etc make sense to my smooth brain. I'm basically just trying to see the transmit rate in Mbps, MB/s, or MB/h, for each node.

Find elsewhere
🌐
Timesofcloud
timesofcloud.com › home › prometheus grafana
Prometheus & Grafana — Rate & Increase -
March 30, 2026 - rate = (last_value - first_value) / time_window_seconds Example: First value at t=0: 1000 Last value at t=300s: 1150 rate = (1150 - 1000) / 300 = 0.5 req/sec
🌐
Grafana
grafana.com › docs › plugins › alexanderzobnin-zabbix-app › latest › reference › functions
Functions reference | Grafana Plugins documentation
Learn how to unify, correlate, and visualize data with dashboards using Grafana. ... No results. ... Takes each timeseries and consolidate its points fallen in the given interval into one point using function, which can be one of: avg, min, max, median. ... Takes timeseries and multiplies each point by the given factor. ... Converts absolute values to delta. This function just calculate difference between values. For the per-second calculation use rate().
🌐
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 - This setup is crucial for understanding how rate() and irate() behave when applied to such metrics. ... NOTE: This is only for assumption, we will not create any application and library to setup this architecture. Now, using either the Prometheus UI or Grafana Explore, we can inspect each metric and its corresponding values in real time.
🌐
Last9
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
June 15, 2026 - Here is a complete example for monitoring request rates across API endpoints: Instrument the API: Expose a counter metric, api_requests_total, with labels for the endpoint and method. Create a Grafana Dashboard: Use the following PromQL query to visualize the request rates:
🌐
Chris's Wiki
utcc.utoronto.ca › ~cks › space › blog › sysadmin › PrometheusRateVsIrate
rate() versus irate() in Prometheus (and Grafana)
November 5, 2018 - Suppose that you have a continuously updating metric that Prometheus scrapes every fifteen seconds. To do a rate() or irate() of this, you need at least two metric points and thus a range interval of thirty seconds (at least; in practice you need a somewhat larger interval).
🌐
Grafana
community.grafana.com › t › applying-a-rate-function-to-positive-and-negative-changes › 8243
Applying a rate function to positive and negative changes - Grafana - Grafana Labs Community Forums
June 22, 2018 - I’ve set up a new graph in Grafana showing the change of a metric using the rate() function. However, it seems to work in inverse (showing a positive value when the gauge drops) and does not show any change when the gauge increases. I’ve plotted the original gauge (yellow, right axis) along with the rate function (green, left axis) to demonstrate this behavior: The following Prometheus queries were used to create them: Rate of change - min(rate(metric_name{cluster=“$cluster”, cluster_type=...
🌐
Grafana
grafana.com › docs › tempo › latest › metrics-from-traces › metrics-queries › functions
TraceQL metrics functions | Grafana Tempo documentation
The rate function calculates the number of matching spans per second that match the given span selectors. The following query shows the rate of errors by service and span name. This is a TraceQL specific way of gathering rate metrics that would ...
🌐
Medium
mopitz.medium.com › understanding-prometheus-rate-function-15e93e44ae61
Understanding Prometheus Rate Function | by Mopitz | Medium
June 21, 2021 - And from that group of points, we are going to apply the rate() function. This will calculate the average rate of increase of each group. So it would look like this: ... Each value, let’s say X, means that in 1 minute the process was running X in each second of that minute. So an example would be:
🌐
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. As you’ve seen, the range interval play an important role in this calc. A best practice suggests us to set this value in the range of 10-60s. Take note, another good practice to avoid data misinterpretation is to set, inside Grafana, Prometheus data source “Scrape interval” with the same interval of Prometheus configuration.
🌐
Medium
medium.com › @pradeepsunku › mastering-prometheus-queries-in-grafana-99b3849b1e03
Mastering Prometheus Queries in Grafana | by PradeepSunku | Medium
August 10, 2024 - While Grafana offers a highly customizable interface for visualizing metrics, mastering Prometheus queries is key to unlocking its full potential. In this article, we’ll explore some essential Prometheus query tips, helping you build more effective dashboards and alerts. ... histogram_quantile(0.99, sum(rate(http_client_requests_seconds_bucket{app=”some-app”}[$__interval])) by (pod_name, le))
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.