仅针对特定名称空间标签过滤发布标签

时间:2020-01-27 14:00:49

标签: prometheus grafana grafana-templating

我有一个grafana实例,该实例监视部署在名称空间中的某些版本。名称空间是在我的查询中硬编码的,例如

jenkins_health_check_score{namespace="build",release="$release"}

我想仅基于变量release

进行过滤

现在的问题是,grafana将在过滤器的所有命名空间中列出部署的发布名称。但我希望它只列出部署在build名称空间中的发行版。

我当前的配置如下

enter image description here

我尝试做类似的事情

label_values(release)
label_values(namespace="build")

但这不起作用。

我得到了错误

Template variables could not be initialized: 2:13: parse error: could not parse remaining input "(release)\nlabel"...

我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

尝试一下:

Query: query_result(jenkins_health_check_score{namespace="build"})
Regex: /release="([^"]+)"/
相关问题