Influxdb 流入通量
这个查询的等价物是什么Influxdb 流入通量,influxdb,influxql,Influxdb,Influxql,这个查询的等价物是什么 select sum("count") from "measurement_name" where time<now() and time>now()-4d group by time(100s),"source" 及 但它们似乎都产生了不同的结果 这是按时间间隔=100s和源进行分组。假设,按时间分组和总和聚合是隐式的?使用Flux中的窗口函数完成,但InfluxQL查询选择的结果。。。它们是:
select sum("count") from "measurement_name" where time<now() and time>now()-4d group by time(100s),"source"
及
但它们似乎都产生了不同的结果
这是按时间间隔=100s和源进行分组。假设,按时间分组和总和聚合是隐式的?使用Flux中的窗口函数完成,但InfluxQL查询选择的结果。。。它们是:
name: measurement_name
tags: source=source_name
time sum
---- ---
1601022500000000000 39
1601022600000000000 191
1601022700000000000 232
1601022800000000000 145
1601022900000000000 207
1601023000000000000 277
1601023100000000000 160
1601023200000000000 228
1601023300000000000 253
1601023400000000000 167
而来自Flux查询的是
Table: keys: [source]
source:string _time:time _value:int _field:string
---------------------- ------------------------------ -------------------------- --------
source_name 2020-09-25T11:46:51.390000000Z 6 count
source_name 2020-09-25T11:46:54.124000000Z 5 count
source_name 2020-09-25T11:46:57.616000000Z 6 count
source_name 2020-09-25T11:46:57.999000000Z 9 count
source_name 2020-09-25T11:46:58.064000000Z 3 count
source_name 2020-09-25T11:46:58.307000000Z 6 count
source_name 2020-09-25T11:47:01.011000000Z 8 count
source_name 2020-09-25T11:47:03.634000000Z 6 count
source_name 2020-09-25T11:47:03.700000000Z 8 count
source_name 2020-09-25T11:47:04.144000000Z 8 count
最终目标是在格拉法纳规划出这一点
是否也有可能在这两种范式之间来回转换?当然,只要有可能,您就需要显式地包含sum函数。我建议也使用
通常,组不保留排序顺序,而是在执行其工作之前按时间进行聚合并进行排序。这是值得寻找的。此外,Flux和InfluxQL查询之间的时间界限可能并不完全一致。我想他们会的,但要仔细检查一下
name: measurement_name
tags: source=source_name
time sum
---- ---
1601022500000000000 39
1601022600000000000 191
1601022700000000000 232
1601022800000000000 145
1601022900000000000 207
1601023000000000000 277
1601023100000000000 160
1601023200000000000 228
1601023300000000000 253
1601023400000000000 167
Table: keys: [source]
source:string _time:time _value:int _field:string
---------------------- ------------------------------ -------------------------- --------
source_name 2020-09-25T11:46:51.390000000Z 6 count
source_name 2020-09-25T11:46:54.124000000Z 5 count
source_name 2020-09-25T11:46:57.616000000Z 6 count
source_name 2020-09-25T11:46:57.999000000Z 9 count
source_name 2020-09-25T11:46:58.064000000Z 3 count
source_name 2020-09-25T11:46:58.307000000Z 6 count
source_name 2020-09-25T11:47:01.011000000Z 8 count
source_name 2020-09-25T11:47:03.634000000Z 6 count
source_name 2020-09-25T11:47:03.700000000Z 8 count
source_name 2020-09-25T11:47:04.144000000Z 8 count
from(bucket:"metrics/default_metrics")
|> range(start: -4d)
|> filter(fn: (r)=> r._measurement == "measurement_name")
|> group(columns: ["source"])
|> aggregateWindow(every: 100s, fn: sum)
|> drop(columns:["_start","_stop","_measurement","column_a","column_b"])
|> yield()