I’ve been banging my head against a wall trying to get this to work correctly.
I am using prometheus as a data source and using grafana 4.4.1.
My ultimate goal is a graph from a prometheus counter that:
req 1. Shows when the value increments and by how much.
req 2. Shows the total counter value given the window interval. ie how much the counter increased in that time.
I have tried a number of different things.
req 1: use the increase() function with an auto interval split into maybe 30 steps or so. This generally tells me what I want. I found that I cannot use the Total functionality in the Legend because it sums incorrectly and changes based on the window interval. My actual total may be 2 but the number shows up as 32.
req 2: Just sum the counter values. This works but I get the counter total from the beginning of the time.
req 1 ex. sum(increase(counter[$auto_interval_variable]))
I can generate both of these requirements independently via the increase function given different intervals.
req 1: Same as attempt 1.
req 2: Use the increase function again but over the window interval, say 3h, would give the correct number. This could be accomplished given a interval template variable used with ‘auto’ but I have found the same thing mentioned here. So it doesn’t work, unless I find a different way to solve req 1 without an auto based interval.
The problem could be solved in a couple of ways; the legend total becomes accurate, I find a way to get two autoscaling intervals, or there is a $__window_interval global variable or something.
I can hardcode another template interval variable that you would have to change to match the window interval but that seems silly. There are variables and automatic things that know this information, you should not have to mirror it manually.