Search code examples
influxdbflux-influxdb

Is there a way to fill a result of sparse data with 0 value points with Flux?


I have points spread out every 5 min, and when the value is 0 the point is just omitted. I'd like to fill the omitted data with empty values.

I see with InfluxQL I could do:

group by time(5m) fill(0)

But I am using InfluxDB 2. I have tried this query:

      from(bucket:"%v")
         |> range(start: %d) 
         |> filter(fn: (r) => r._measurement == "volume" and r.id == "%v")
         |> window(every: 5m, period: 5m, createEmpty: true)
         |> fill(value: 0)

But it does not appear to be working.

Any help is appreciated.


Solution

  • It turns out this is a bug in InfluxDB related to https://github.com/influxdata/influxdb/issues/21857

    Apparently the window function does not work either.