我想统计一个度量X在过去1周内的事件数,并使用InfluxDB连续查询将其定期存储到另一个度量Y中。但是,在查询中似乎必须“按时间分组” 。这导致将结果分成多个时间范围窗口。有没有办法禁用GROUP BY或在GROUP BY中指定一些不会导致结果分裂的持续时间?
连续查询
CREATE CONTINUOUS QUERY "cq_advanced_every_for" ON "transportation"
RESAMPLE EVERY 1h FOR 7d
BEGIN
SELECT COUNT(DISTINCT("event_name")) INTO "weekly_event_count" FROM "daily_event_count" GROUP BY time(7d)
END
查询
SELECT * FROM weekly_event_count
输出
time count
---- -----
2020-08-20T00:00:00Z 25000 -->I expected the timestamp to be 2020-08-19 as the query was run on 2020-08-26