-
What Grafana version and what operating system are you using?
Grafana v10.1.0 (ff85ec33c5) -
What are you trying to achieve?
I am trying to calculate the total number of requests in a specific period of time. -
How are you trying to achieve it?
By using the increase() function over a time range. -
What happened?
I received results that do not match my expectations.
Description
Hello, I have a metric of type counter
with the following labels:
host
method
handler
code
I am using this metric to calculate the total number of requests made by my application. Over the last hour, I performed 6 requests: 3 from host1
and 3 from host2
.
When I use the following query:
increase(my_metric_counter[1h])
I get this result:
{code=“200”, handler=“myHandler”, host=“host1”, method=“GET”, path=“myPath”} = 2.00276
{code=“200”, handler=“myHandler”, host=“host2”, method=“GET”, path=“myPath”} = 1.00138
I was expecting to see 3 for each series instead.
What did I check?
- I verified the metric values using a simple query (
my_metric_counter
), and the data shows 3 requests for each host. - I reviewed the Prometheus documentation and other forum topics but couldn’t understand why the
increase()
function returns these fractional results.
Can someone explain why this is happening and how I can adjust my query to get the correct total?