To calculate aggregate sum of data points with resolution in time of one minute, you can specify that resolution in the range selector like this

sum_over_time(my_requests[$__range:1m])
Answer from markalex on Stack Overflow
🌐
Prometheus
prometheus.io › docs › concepts › metric_types
Metric types | Prometheus
Instrumentation library usage documentation for gauges: ... A histogram records observations (usually things like request durations or response sizes) by counting them in configurable buckets. It also provides a sum of all observed values. As such, a histogram is essentially a bucketed counter.
Discussions

How to sum up Gauges in PromQL (for alerting) - PromQL - Prometheus Monitoring System
Hi there, so I have my own exporter which exposes some gauges: my_latencies{endpoint="a", metric="p100"} 12 my_latencies{endpoint="a", metric="p50"} 7 my_latencies{endpoint="a", metric="p0"} 1 my_latencies{endpoint="b", metric="p100"} 299 ... It’s important to know that these gauges are scraped ... More on discuss.prometheus.io
🌐 discuss.prometheus.io
0
April 11, 2022
prometheus - How to sum up Gauges in PromQL (for alerting) - Stack Overflow
so I have my own Prometheus Exporter which exposes some gauges: my_latencies{endpoint="a", metric="p100"} 12 my_latencies{endpoint="a", metric="p50"} 7 my_latencies{endpoint="a", metric="p0"} 1 my_latencies{endpoint="b", metric="p100"} 299 ... It’s important to know that these gauges are scraped every minute, but not every minute there will be data. So plotted graphs will contain holes… · What I do want to achieve is an alerting when the sum ... More on stackoverflow.com
🌐 stackoverflow.com
Display sum of all gauge's values
Hello, I’m very new to Grafana and Prometheus. I’m using Grafana v8.2.6 on Windows 10, along with Prometheus. It scrapes a Gauge metric that is sent every 2 minutes. I would like to display a stat that corresponds to a running sum of all values the Gauge ever had. More on community.grafana.com
🌐 community.grafana.com
3
0
May 31, 2023
promql function to sum distinct for gauge value
For example · query: my_metrics{app="telegraf"}[5m] result: {app="telegraf"} 336 @1637319417.799 336 @1637319427.803 336 @1637319437.799 510 @1637319497.799 317 @1637319507.799 317 @1637319517.799 317 @1637319527.799 317 @1637319537.799 317 @1637319547.799 317 @1637319557.799 · So I'm trying to get the sum_over_time from that gauge, but since Prometheus ... More on github.com
🌐 github.com
11
November 19, 2021
🌐
Robust Perception
robustperception.io › common-query-patterns-in-promql
Common query patterns in PromQL – Robust Perception | Prometheus Monitoring Experts
May 1, 2017 - sum without (instance)(my_gauge) avg without (instance)(my_gauge) Similarly for min and max. For counters you need to take a rate, and then aggregate: sum without (instance)(rate(my_counter_total[5m])) A summary contains _sum and _count counters, from which we can calculate the average event size.
🌐
TigerData
tigerdata.com › blog › four-types-prometheus-metrics-to-collect
A Deep Dive Into the Four Types of Prometheus | Tiger Data
December 10, 2025 - The metric name uses the _sum suffix. Optionally, a number of quantiles of measurements are exposed as a gauge using the metric name with a quantile label. Since you don’t want those quantiles to be measured from the entire time an application has been running, Prometheus client libraries use streamed quantiles that are computed over a sliding time window (which is usually configurable). For example, the summary metric to measure the response time of the instance of the add_product API endpoint running on host1.domain.com could be represented as:
🌐
VictoriaMetrics
victoriametrics.com › blog › prometheus metrics explained: counters, gauges, histograms & summaries
Prometheus Metrics Explained: Counters, Gauges, Histograms & Summaries
February 21, 2025 - Metrics come in different types: counters that only increase, gauges that fluctuate, histograms that show value distributions, and summaries that pre-calculate …
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
delta acts on histogram samples by calculating a new histogram where each component (sum and count of observations, buckets) is the difference between the respective component in the first and last native histogram in v. However, each element in v that contains a mix of float samples and histogram samples within the range will be omitted from the result vector, flagged by a warn-level annotation. delta should only be used with gauges (for both floats and histograms).
🌐
Promlabs
promlabs.com › blog › 2020 › 09 › 25 › metric-types-in-prometheus-and-promql
PromLabs | Blog - Metric Types in Prometheus and PromQL
September 25, 2020 - There are no functions that are specific to summary metrics (as there is not much you can compute over a quantile value), but you can conceptually see the quantile values exported from a summary metric as a set of gauges. PromQL functions can usually not figure out and complain automatically when you are passing in the wrong metric type, but we recommend following the Prometheus metric naming best practices to at least make it easy for humans to see what type of metric they are dealing with. For example, counters should end with _total, whereas gauges should not have such a suffix.
Find elsewhere
🌐
Prometheus
discuss.prometheus.io › promql
How to sum up Gauges in PromQL (for alerting) - PromQL - Prometheus Monitoring System
April 11, 2022 - Hi there, so I have my own exporter which exposes some gauges: my_latencies{endpoint="a", metric="p100"} 12 my_latencies{endpoint="a", metric="p50"} 7 my_latencies{endpoint="a", metric="p0"} 1 my_latencies{endpoint="b", metric="p100"} 299 ...
🌐
Tom Gregory
tomgregory.com › how-and-when-to-use-a-prometheus-gauge
How and when to use a Prometheus gauge | Tom Gregory
February 5, 2021 - The Java client library for creating Prometheus gauges is io.prometheus:simpleclient and can be downloaded from Maven central. Here's an example of using it to measure the size of a queue.
🌐
Stack Overflow
stackoverflow.com › questions › 71828344 › how-to-sum-up-gauges-in-promql-for-alerting
prometheus - How to sum up Gauges in PromQL (for alerting) - Stack Overflow
so I have my own Prometheus Exporter which exposes some gauges: my_latencies{endpoint="a", metric="p100"} 12 my_latencies{endpoint="a", metric="p50"} 7 my_latencies{endpoint="a", metric="p0"} 1 my_latencies{endpoint="b", metric="p100"} 299 ...
🌐
Grafana
community.grafana.com › dashboards
Display sum of all gauge's values - Dashboards - Grafana Labs Community Forums
May 31, 2023 - Hello, I’m very new to Grafana and Prometheus. I’m using Grafana v8.2.6 on Windows 10, along with Prometheus. It scrapes a Gauge metric that is sent every 2 minutes. I would like to display a stat that corresponds to …
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › operators
Operators | Prometheus
For example, if an instant vector of float samples is multiplied by 2, the result is another vector of float samples in which every sample value of the original vector is multiplied by 2. For vector elements that are histogram samples, the behavior is the following: For *, all bucket populations ...
🌐
GitHub
github.com › prometheus › prometheus › issues › 9822
promql function to sum distinct for gauge value · Issue #9822 · prometheus/prometheus
November 19, 2021 - For example · query: my_metrics{app="telegraf"}[5m] result: {app="telegraf"} 336 @1637319417.799 336 @1637319427.803 336 @1637319437.799 510 @1637319497.799 317 @1637319507.799 317 @1637319517.799 317 @1637319527.799 317 @1637319537.799 317 @1637319547.799 317 @1637319557.799 · So I'm trying to get the sum_over_time from that gauge, but since Prometheus ...
Author: prometheus
🌐
OpenObserve
openobserve.ai › home › blog › prometheus metrics types
Prometheus Metric Types (Counters, Gauges, Histograms, Summaries)
November 19, 2025 - When Prometheus metrics are ingested into O2, each sample becomes a row with: metric → name of the metric (e.g., http_requests_total) ... Gauge values can go up or down, so queries focus on current state, min/max, average, trends. ... Histogram metrics expose bucket counts, sum, and count, ...
Top answer
1 of 2
5

count_over_time(response_time_ms[1m]) will tell you the number of samples, not the number of times your Gauge was updated within (what I assume to be) a Java process. Based on the value of 10 you're seeing, I'm assuming your scrape interval is 6 seconds.

For an explanation of why this doesn't work as you would expect it, a Gauge is simply a Java object wrapping a double value. Every time you set its value, that value changes, but nothing more. There's no count of how many times the value changed or any notification sent to Prometheus that this happened. Prometheus simply polls every 6 seconds and collects whatever value was there at the time (never the wiser that the value changed 15 times since the last time it was collected). This is why gauges are intended to measure single values that go up and down (such as memory utilization: it's now 645 MB, in 6 seconds it's 648 MB, in 12 seconds 543 MB): you know the value constantly changes, but the best you can do is sample it every now and then.

For something like request latency, you should use a Histogram: it's basically a counter for the number of observations (i.e. number of requests); a counter for the sum of all observations (i.e. how long all requests put together took); and separate counters for each bucket (i.e. how many requests took less than 1 ms; how many requests took less than 10 ms; etc.). From this you can get an accurate average over any multiple of your scrape interval (i.e. change in total time divided by change in number of requests) as well as estimates for any percentile (including the median). How precise said percentiles are depends on the bucket sizes you choose (and how well they actually match the actual measurements).

Or, if all you're interested in is the number of requests, then a counter that's incremented on every request will be enough. To adjust for counter resets (e.g. job restarts), you should use increase() rather than the simple difference suggested above:

increase(number_of_requests_total[1m])
2 of 2
0

If you want to count number of requests in some specific time from now (in last 1m in this case) just use

number_of_requests_counter - number_of_requests_counter offset 1m

If you want to have sth like requests per second, than use

rate(number_of_requests_counter[1m])

I can tell you why it's not working with your Gauge, but first of all specify what do you assign to this metric. I mean, do you assing some avarage, last response time, or some other stuff?

For response time you should use Summary or Histogram (more info here)

🌐
Google Groups
groups.google.com › g › prometheus-users › c › I7Vcd7nY41Q
Sum over range vector?
... Either email addresses are ... On Wednesday, January 3, 2018 at 11:03:15 AM UTC-7, Ben Kochie wrote: You can use sum_over_time(foo[5m]) to add up all the values in a metric over time....
🌐
Last9
last9.io › blog › prometheus-metrics-types-a-deep-dive
Prometheus Metrics Types - A Deep Dive | Last9
June 17, 2026 - How Prometheus counters, gauges, histograms, and summaries work, which PromQL functions fit each, the cardinality traps to avoid, and how to choose the right type.
🌐
DEV Community
dev.to › sunnynazar › the-complete-guide-to-prometheus-metric-types-promql-alerting-and-troubleshooting-5a69
The Complete Guide to Prometheus Metric Types - DEV Community
January 18, 2026 - # "Our error rate is too high" - alert: HighErrorRate expr: | sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) > 0.05 for: 5m labels: severity: critical annotations: summary: "Error rate exceeds 5%" # "Traffic ...
🌐
Medium
medium.com › @Nitish_Mane › promql-examples-by-metric-type-2eb3ffb6aa8c
PromQL examples by Metric Type — Part 4 | by Nitish Mane | Medium
October 14, 2024 - Summing Across Instances: Use sum() to aggregate counters across multiple instances. These PromQL examples demonstrate how to use Counters in Prometheus for tracking totals, rates, and increases over time, making them ideal for monitoring things ...
🌐
Tom Gregory
tomgregory.com › the-four-types-of-prometheus-metrics
The 4 Types Of Prometheus Metrics | Tom Gregory
December 2, 2019 - Summaries and histograms share a lot of similarities. Summaries preceded histograms, and the recommendation is very much to use histograms where possible. It's worth noting these key differences between histograms and summaries: with histograms, quantiles are calculated on the Prometheus server.