由label_replace引入的基于过滤向量的新标签

时间:2019-06-07 18:16:37

标签: grafana prometheus promql

在Prometheus中,我尝试使用label_replace将多个HTTP请求行合并为组。

http_requests_total{account_id="124",handler="AAAAAController"...}
http_requests_total{account_id="125",handler="BBBBBController"...}
http_requests_total{account_id="126",handler="CCCCCController"...}
http_requests_total{account_id="123",handler="XXXXXController"...}

我写的查询是:

label_replace(http_requests_total, "class", "$1", "handler", "([a-zA-Z0-9]+)Controller.*")

这可以正常工作,并将class标签添加到vector:“ AAAA”,“ BBBB”等。在这一点上,我想删除某些类,例如empty和BBBB

如何使用{class~="BBBBB"}进一步过滤向量:

label_replace(http_requests_total, "class", "", "handler", "([a-zA-Z0-9]+)Controller.*"){class~="BBBBB"}

Prometheus尝试执行此操作时显示错误。

0 个答案:

没有答案
相关问题