In migrating to influxdb2 and fkux I find a difference in timestamps in the grouping of fields.
influxql group by time(1m) associates the time with start of each period. flux agregatewindow(every 1m)
or window(every 1m) puts it at the end. I am using the same input source (loaded from files) .
e.g.
influxql SELECT mean(“load_instant_power”) AS “home” FROM “powerwall”.“raw”.“http” WHERE time >= :dashboardTime: AND time < :upperDashboardTime: group by time(1m) TZ(‘Australia/Sydney’)
time | http.home |
---|---|
2022-12-14T00:00:00.000+11:00 | 369.25 |
2022-12-14T00:01:00.000+11:00 | 372.75 |
import “math”
import “timezone”
option location = timezone.location(name: “Australia/Sydney”)
from(bucket: “powerwall/raw”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “http” )
|> filter(fn: (r) => r[“_field”] == “load_instant_power” )
|> map(fn: (r) => ( { r with “_measurement”: “home”, “_field”: “power” }))
|> aggregateWindow(every: 1m, fn: mean, createEmpty: false)
_time | _start | _stop | _field | _measurement | host | _value |
---|---|---|---|---|---|---|
2022-12-13T13:01:00Z | 2022-12-13T13:00:00Z | 2022-12-14T01:00:00Z | power | home | powerwall | 369.25 |
2022-12-13T13:02:00Z | 2022-12-13T13:00:00Z | 2022-12-14T01:00:00Z | power | home | powerwall | 372.75 |
… | ||||||
I can fix this by using | ||||||
> window(every 1m) | ||||||
… | ||||||
> mean() | ||||||
> duplicate(column: “_start”, as: “_time”) |
It just seems like a major change of philosophy to me. My battery weekly stats shows wednesdays data as wednesday - the default for influxv2 would be show as thursday %-)