用作 grafana 变量的通量查询,它将返回来自 Influx Cloud 的特定测量中的所有键

问题描述 投票:0回答:0

我想从特定存储桶中获取特定测量的所有键,以在 Grafana 仪表板上的变量中使用。

我相当确定我的开始是正确的:

from(bucket: "my_bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "host")

如何从测量中获得键列表

host

我试过添加:

|> keys()
and
|> columns() 
|> keep(columns: ["_value"]) 
|> group() 
|> distinct()

我怀疑可能涉及:

|> schema.tagKeys()

但是我无法在 Flux Cloud Data Explorer 中导入模式。

我知道这一定很简单,但我无法在文档或搜索中找到答案。

grafana influxdb flux flux-influxdb
© www.soinside.com 2019 - 2024. All rights reserved.