influxdb
influxdb copied to clipboard
Question: aggregateWindow function doesn't work as my expectation
Data Set:
_start | _stop | _time | _value | _field | _measurementservice |
---|---|---|---|---|---|
2022-08-04 13:34:00 | 2022-08-04 13:37:00 | 2022-08-04 13:34:00 | 66.06 | CpuUsage | Mongo |
2022-08-04 13:34:00 | 2022-08-04 13:37:00 | 2022-08-04 13:35:00 | 68.38 | CpuUsage | Mongoprod |
2022-08-04 13:34:00 | 2022-08-04 13:37:00 | 2022-08-04 13:36:00 | 90.55 | CpuUsage | Mongoprod |
Query:
from(bucket: "default")
|> range(start: 2022-08-04T05:34:00.000Z, stop: 2022-08-04T05:37:00.000Z)
|> filter(fn: (r) => r["_measurement"] == "Mongo")
|> filter(fn: (r) => r["_field"] == "CpuUsage" and r["service"] == "prod")
|> aggregateWindow(every: 3m, fn: mean, createEmpty: false)
Query Result:
_start | _stop | _time | _value | _field | _measurement | service |
---|---|---|---|---|---|---|
2022-08-04 13:34:00 | 2022-08-04 13:37:00 | 2022-08-04 13:36:00 | 67.22 | CpuUsage | Mongo | prod |
2022-08-04 13:34:00 | 2022-08-04 13:37:00 | 2022-08-04 13:37:00 | 90.55 | CpuUsage | Mongo | prod |
My Question:
- With the query string above, I expected one line data, but actual result is two lines.
- And I want to know the detail about how the func
aggregateWindow
works, I can't get more infomation from influxdb's doc. - how the parameter every of
aggregateWindow
split data to windows