autoInterval support in v2

#1

I use InfluxDB v2 alpha 8 to visualize some sensor data. The sensors update about once per minute. I have noticed that when I select a large time window (e.g. 2 weeks), a large amount of data is transmitted, which is slow and unnecessary.

Therefore I thought it would be useful to have the graphs automatically show the mean of the data, using a variable time window based on the selected duration.

I have seen How To: Building Flux Queries in Chronograf which uses every: autoInterval which seems to do exactly what I want. When I try to use it like:

from(bucket: “home”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r.topic == “sensor/living/light”)
|> aggregateWindow(fn: mean, every: autoInterval)

I get the error

failed to compile query: type error 6:39-6:51: undefined identifier “autoInterval”

I also tried to manually calculate a window, but I am not sure what the syntax should look like. e.g. something like

from(bucket: “home”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r.topic == “sensor/living/light”)
|> aggregateWindow(fn: mean, every: (v.timeRangeStop - v.timeRangeStart) / 100)

Is that possible? Thanks!