【问题标题】:grafana: use a variable in the definition of another variablegrafana:在另一个变量的定义中使用一个变量
【发布时间】:2018-03-29 15:27:12
【问题描述】:

我正在尝试为 git 项目构建仪表板。我有一个 influxDB,其中包含每个分支中每个构建的数据。

我已经为存储库定义了一个变量,查询为show tag values with key=repo。我想要的是,一旦设置了该值,就有第二个变量称为branch,它在其查询中使用repo 变量。我试过show tag values with key=branch where repo='$repo',但是不行。

我不知道怎么做。

【问题讨论】:

    标签: influxdb grafana


    【解决方案1】:

    我想通了。我需要用斜杠包围变量:

    show tag values with key=branch where repo=/$repo/
    

    【讨论】:

      【解决方案2】:

      也使用 InfluxDB。 /$variable/ 对我不起作用,我需要稍微不同的转义。对于这个特定的查询,我还需要 =~ 而不是 =

      select "end" from "summary" where "build" =~ /^$build$/
      

      【讨论】:

        猜你喜欢
        • 2011-11-14
        • 1970-01-01
        • 1970-01-01
        • 2022-11-23
        • 2015-05-24
        • 1970-01-01
        • 2018-03-09
        • 1970-01-01
        • 2018-03-13
        相关资源
        最近更新 更多