Reputation: 195
I am using increase on a counter metric to get the increase in HTTP connections for the last 10 minutes:
increase(http_connections{kind="test"}[10m])
This expression returns two distinct values within my test environment:
15.789
12.631
How can I get the average of the above values?
Upvotes: 3
Views: 3119
Reputation: 2365
To flatten that out, you can either increase the interval, simply query for the increase of the last 20min and then divide that by two:
increase(http_connections{kind="test"}[20m]) / 2
(or query the last 30 min and divide by 3)...
Alternatively you can also use the avg_over_time()
function with subquery:
avg_over_time(increase(http_connections{kind="test"}[10m])[10m:1m])
this will take one value per minute over the last 10 minutes and use the average of these 10 values as the current value
Upvotes: 11