I am a little unclear on when to exactly use increase and when to use sum_over_time in order to calculate a periodic collection of data in Grafana. I want to calculate the total percentage of availability of my system. Thanks.
Asked
Active
Viewed 9,316 times
1 Answers
23
The "increase" function calculates how much a counter increased in the specified interval.
The "sum_over_time" function calculates the sum of all values in the specified interval.
Suppose you have the following data series in the specified interval:
5, 5, 5, 5, 6, 6, 7, 8, 8, 8
Then you would get:
increase = 8-5 = 3
sum_over_time = 5+5+5+5+6+6+7+8+8+8 = 63
If your goal is to calculate the total percentage of availability I think it's better to use the "avg_over_time" function.

Marcelo Ávila de Oliveira
- 19,950
- 3
- 39
- 50
-
Thanks. Will try this out. – pixelWorld Aug 06 '20 at 19:31
-
So if my use case is to find the total availability percentage of my system then would be something like this: sum (sum_over_time(metric_name{response_code!~"2.*"}[$__range])) / sum (sum_over_time(metric_name{}[$__range]))/ * 100 ? As I am getting some incorrect data – pixelWorld Aug 07 '20 at 23:35
-
I think so. You just need to remove the "/" before the "* 100". – Marcelo Ávila de Oliveira Aug 09 '20 at 18:58
-
Thanks. '/' was a typing mistake here. – pixelWorld Aug 10 '20 at 17:30