Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic aggregation timebuckets using $__interval and $__interval_ms #280

Open
ajshsu opened this issue Dec 2, 2022 · 1 comment

Comments

@ajshsu
Copy link

ajshsu commented Dec 2, 2022

Currently, the TS.RANGE and TS.MRANGE aggregations only support fixed numerical input. This doesn't allow the dashboards to dynamically change the bucket size as the query time range changes. Particularly with large time ranges, this can cause Grafana to slow down a lot since there are a lot of data points in each series.

It would be nice to use Grafana's $__interval and $__interval_ms variables as inputs to the TimeBucket field in TS.RANGE and TS.MRANGE.

Perhaps if the Timebucket field is left empty, the default value will be the $__interval_ms value instead of 0, which doesn't give a valid query anyway. Or a value of 0 could be used the $__interval_ms value

@nickvdp
Copy link

nickvdp commented Apr 20, 2023

This would be very useful.

We have a chart that is useful to view for a 15 minute and multi-day time period.
When viewing for 15 minutes, a 1s interval is ideal and show us all our data. This is ~200KB of data.
However, if we extend the time period to 2 days, that's 76MB.
Grafana sets $__interval / $__interval_ms to 2m / 120000 in this case, but the Redis aggregation time bucket is not dynamic so we still get data for 1s resolution. This is really inefficient for the client and networking.

This same functionality is easy with the Prometheus data source, because you can use $__interval in the query.

Both of these would be good solutions:

  • use $__interval_ms as the value when left blank. This was suggested above and I think it would be a good solution.
  • make the field string type and allow the use of $__interval/$__interval_ms variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants