给定一个桶,我如何使用 Flux 查询在给定时间间隔内获取这个桶中带有时间戳的点数?
我正在尝试估算每单位时间有多少数据被添加到 influxdb2 存储桶中。
最佳答案
我觉得应该是这样的:
from(bucket: "my_bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "my_measurement")
|> window(period: 30s)
|> group(columns: ["_start"])
|> count()
首先我们按时间窗口|> window(period: 30s) 分离数据
然后我们按新的 _start
时间分组并获取记录数。
关于influxdb - 使用 Flux 查询获取某个时间间隔内桶中的点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70746764/