Hi,
I have a dashboard where I’ve added a interval type variable to be able to set the granularity of my graphs. I use the variable by changing “GROUP BY time($__interval)” to "GROUP BY time(myvar)" in my influx db series queries.
Now, this works as expected. I'm able to select whatever granularity I want and the graphs update accordingly.
The issue I'm having is slow performance when I zoom out while having a fine granularity, e.g. 1m. I take it that it's due to a massive amount of data is returned by the query, much more than is needed to produce the graph. This is normally controlled by the __interval which makes sure to to select more data than can be represented by the pixels on the screen.
So, what I’d like is to add my myvar, but still have __interval as a lower limit in the GROUP BY statement.
Intuitively I tried things like GROUP BY max($__interval, $myvar), but that does not seem to be supported.
Is there any way to get the functionality I describe?
Thanks!
Hello,
Although this isn’t exactly the functionality you described, it still may be helpful:
Under the metrics tab of a graph panel, you can set a minimum time interval under the Options dropdown menu.
I have not used this functionality very much, but I can imagine that it can be useful for performance optimization. Perhaps you can even try using templating variables to dynamically change this minimum interval.
2 Likes
Thanks for your reply!
Yes, this does indeed seem like a perfect fit. I group by $myvar in the query and use $__interval as a lower limit in options. There’s a tool tip text even suggesting using $__interval or $__interval_ms.
All great, except I can’t get it to work. I get empty graphs when I try to use either $__interval or $__interval_ms. It works as expected if I set it to some fixed value, e.g. “1h”.
Any suggestions on what I could be doing wrong or how I could debug this?
Thanks
The Min time interval input box defines a lower limit for $__interval
and $__interval_ms
, so setting the minimum value of $__interval
as $__interval
cannot work.
However, you can achieve the functionality you originally described by setting the Min time interval with $myVar
and using GROUP BY time($__interval)
in your query, like so;
where $myVar
is defined by:
Have fun!
Excellent! It works perfectly!
Thanks!