【发布时间】:2021-10-25 07:30:14
【问题描述】:
试图找到一种使用 Prometheus 查询来替换 2 个或更多标签的方法,但没有找到任何好的和“短”的方法。
这是我所拥有的:
label_replace(
label_replace(
label_replace(
label_replace(
rate(spring_integration_send_seconds_count{result!="success", application="MyApplicationName"}[1m])
,"service", "$1", "name", "(.*).ConsumerEndpointFactoryBean.*"
)
, "service", "$1", "name", "(.*).channel.*"
)
, "service", "$1", "name", "(.*).Channel.*"
)
, "service", "$1", "name", "(.*).handler.*"
)
)
是否有更短/更整洁的方法来替换标签?
在我的例子中,我有 4 种情况我想“跳过”结尾, 当标签值结束时:
- .ConsumerEndpointFactoryBean
- .频道。 (以小写字母开头)
- .频道。 (以大写开头)
- .handler.
【问题讨论】:
标签: prometheus grafana promql