As it was repeated numerous times, again and again rate must be applied before sum.

Additionally both rate and irate require at least two samples in range vector to return anything. I doubt that you have a scrape interval of less then 8 seconds. So most likely you range selector is incorrect, and you need something bigger like [30s] or anything, but at least twice your scrape interval. And if you are planning to use it in Grafana you can use [$__rate_interval] instead: Grafana will substitute best suited value itself.

Your query should look like

sum by (app) (rate(application_errors_total[30s]))
Answer from markalex on Stack Overflow
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
The quantile is calculated for each label combination in http_request_duration_seconds. To aggregate, use the sum() aggregator around the rate() function. Since the le label is required by histogram_quantile() to deal with classic histograms, it has to be included in the by clause.
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › examples
Query examples | Prometheus
Return the per-second rate for all time series with the http_requests_total metric name, as measured over the last 5 minutes: ... Assuming that the http_requests_total time series all have the labels job (fanout by job name) and instance (fanout by instance of the job), we might want to sum over the rate of all instances, so we get fewer output time series, but still preserve the job dimension:
🌐
MetricFire
metricfire.com › blog › understanding-the-prometheus-rate-function
How the Prometheus rate() function works | MetricFire
March 12, 2026 - You can apply rate() to specific dimensions, making monitoring error rates for different backends useful. Before we discuss Prometheus functions too deeply, we first need to discuss some basic concepts and terminology. PromQL is a custom query language for the Prometheus project used to filter and search through Prometheus' time series data. When querying in PromQL, every metric has four components: ... Labels, i.e.
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › basics
Querying basics | Prometheus
Multiple units can be combined by concatenation of suffixed integers. Units must be ordered from the longest to the shortest. A given unit must only appear once per float literal. ... 1h30m # Equivalent to 5400s and thus 5400. 12h34m56s # Equivalent to 45296s and thus 45296. 54s321ms # Equivalent to 54.321. Arithmetic expressions can be used wherever a time duration is expected, that is in range vector selectors and in offset durations. ... rate(http_requests_total[5m * 2]) # 10 minute range rate(http_requests_total[(5+2) * 1m]) # 7 minute range
🌐
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).
🌐
CNCF
cncf.io › blog › 2025 › 07 › 22 › prometheus-labels-understanding-and-best-practices
Prometheus Labels: Understanding and Best Practices | CNCF
November 12, 2025 - Here are some of the common examples of where PromQL leverages Prometheus labels for its queries. We’ll explore these in detail and understand how they can be useful in the coming sections: ... The above query calculates how many HTTP requests have a status code 500 in the last 5 minutes. Using PromQL, we filter the metric to focus only on failed requests, to quickly spot error spikes without being distracted by successful requests. rate(http_requests_total{method="POST", endpoint="/api/login"}[5m])
🌐
Promlabs
promlabs.com › promql-cheat-sheet
PromLabs | PromQL Cheat Sheet
histogram_quantile( 0.9, sum by(le, path, method) ( rate(demo_api_request_duration_seconds_bucket[5m]) ) )
Find elsewhere
🌐
Fiberplane
fiberplane.com › blog › why-are-prometheus-queries-hard
Why are Prometheus queries hard? | Fiberplane Blog
July 4, 2023 - If we want to look at how many requests are being returned with different HTTP status codes, independent of the path, we can use this query and we would see the results that follow: ... This sum by (labels) (rate(metric[5m])) construction is ...
🌐
GitHub
github.com › prometheus › prometheus › issues › 7922
Add function: Ratio between two (label,value) sets on the same metric · Issue #7922 · prometheus/prometheus
September 10, 2020 - This will reduce. the execution time by 50%. Therefore, the proposal is to have a function in prometheus called ratio(...) which takes three parameters: ... And the result of ratio(...) will be the ratio of the number of events happened with the first set of (label,value) pairs to the number of events happened with the second Set of (label,value) pairs.
Author: prometheus
🌐
Last9
last9.io › blog › prometheus-rate-function
Prometheus Rate Function: A Practical Guide to Using It | Last9
June 15, 2026 - Master Prometheus remote write optimization. Learn queue tuning, cardinality management, and relabeling strategies to scale your monitoring infrastructure efficiently. ... An important but often overlooked aspect of rate() is how it handles extrapolation. The function doesn’t simply divide the total increase by ...
🌐
Middleware
middleware.io › blog › prometheus-labels
Prometheus Labels: Understanding and Best Practices
The above will first group all the HTTP request rates in the last 5 minutes by the value of the labels Prometheus provides, specifically status and endpoint.
🌐
Chronosphere
chronosphere.io › home › top 3 queries to add to your promql cheat sheet
Top 3 queries to add to your PromQL cheat sheet
April 2, 2025 - If you have 1000 counter series with the metric name “api_requests_total” that partition your API requests by various label dimensions, you will now get 1000 output rates — one for each input series. The label dimensions that partition the metric name into many time series can be aspects like: ... This level of dimensional insight in Prometheus is great, but you will often want to show an overall request rate for your service, with some dimensions aggregated away.
🌐
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 - It uses the full range of data points returned by the query http_requests_total[5m]. Since rate() works on counter metrics, it calculates the per-second average rate of increase by using the first and last data points in the range vector. In this case, because we’re using the http_requests_total metric, the unit of the result is requests per second (req/s). ... The visual representation already gives you a good sense of how the rate() function works under the hood. Let’s break it down using the /v3 label metric as an example. ... So, over the 5-minute window, Prometheus calculates an average of 0.6 requests per second for the /v3 path.
🌐
Last9
last9.io › blog › guide-to-prometheus-query-language
PromQL: A Developer's Guide to Prometheus Query Language | Last9
February 26, 2026 - This query sums the rate of 5xx errors, grouped by the path label value. Range queries allow you to evaluate PromQL expressions over a range of time. Here’s an example: ... This range query calculates the rate of HTTP requests over 5-minute ...
🌐
Promlabs
promlabs.com › blog › 2023 › 09 › 19 › errors-successes-totals-which-metrics-should-i-expose-to-prometheus
PromLabs | Blog - Errors, Successes, Totals: Which Metrics Should I Expose to Prometheus?
September 19, 2023 - But calculating the error rate ratio becomes a bit more involved. You have to aggregate over the outcome label on both sides of the operation to make the label matching work (alternatively, you could use an ignoring(outcome) modifier on the binary operator):
🌐
Medium
medium.com › @suchitasharma1106 › a-comprehensive-guide-to-grouping-and-functions-in-promql-cc3c438be320
A Comprehensive Guide to Grouping and Functions in PromQL | by Suchita Sharma | Medium
October 7, 2024 - In this blog, we’ll cover grouping ... helps in aggregating data across multiple dimensions. It allows you to summarize or categorize metrics based on their labels....
🌐
GitHub
github.com › grafana › alloy › issues › 6844
Prometheus Rate Limit · Issue #6844 · grafana/alloy
August 7, 2026 - We’d like to apply independent rate limits using a label such as product or namespace. A new rate limit component prometheus.limit, taking inspiration from the loki.process's stage.limit configurations. prometheus.limit "metrics" { forward_to ...
Author: grafana
🌐
Better Stack
betterstack.com › community › questions › do-i-understand-prometheus-rate-vs-increase-correctly
Do I Understand Prometheus's Rate Vs Increase Functions Correctly? | Better Stack Community
December 2, 2024 - To count unique label values in Prometheus, you can use the count function along with the by clause to aggregate metrics based on a specific label.
🌐
GitHub
github.com › prometheus › prometheus › issues › 5355
rate() is inaccurate for new label · Issue #5355 · prometheus/prometheus
March 14, 2019 - Bug Report What did you do? I have a metric that shows calls to my app's "export" function. I use labels to signify what is exported, and in which format. I then plot this using sum(rate(export_total[1m])) by (what, extension) What did y...
Author: prometheus