簡體   English   中英

PromQL/prometheus 查詢 label_replace() 多個

[英]PromQL/prometheus query label_replace() multiple

試圖用普羅米修斯查詢找到一種方法來替換 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 種情況我想“跳過”結尾,當 label 值的結尾是:

  • .ConsumerEndpointFactoryBean
  • 。渠道。 (以小寫字母開頭)
  • 。渠道。 (從資本開始)
  • .處理程序。

沒關系,這只是正則表達式的問題

label_replace(
    rate(spring_integration_send_seconds_count{result!="success", app="MyApplicationName"}[1m])
     ,"service", 
    "$1", 
    "name",   "(.*).(channel|Channel|handler|ConsumerEndpointFactoryBean).*"
    )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM