Closed toluschr closed 3 months ago
I'll take a look later. But for me to better understand: The macro is a helper that formats a query. The performance issue you describe should be solvable without the macro as well, right?
I'll take a look later. But for me to better understand: The macro is a helper that formats a query. The performance issue you describe should be solvable without the macro as well, right?
It is essentially a shorthand form for:
(timestamp BETWEEN ${__from:date:seconds} AND ${__to:date:seconds})
I wasn't aware that these two variables exist, so I queried everything from the database and filtered afterwards. But I believe the macro could be useful regardless.
Just discovered this PR; I am using SQLite as a backend and this macro would be very helpful.
@SeanCGriffin could you elaborate how this macro would be helpful for you?
As far as I understand the macro simply "transforms"
$__timeFilter(timestamp)
into
(timestamp BETWEEN ${__from:date:seconds} AND ${__to:date:seconds})
I am not sure yet if adding this macro would be that helpful. After all the macro would be something custom that people need to find in this repos documentation, whereas the variable approach is standard and documented at Grafana's side for all plugins.
I will close the PR for now in order to gain some more understanding of the underlying problem.
Let's open an issue if you want to continue on this and we can re-open the PR any time.
Grafana is really unresponsive when using this plugin for large datasets. Implementing the
__timeFilter
macro results in a significant speedup.In addition to this, future candidates could be
$__timeFrom()
and$__timeFrom()
.