【问题标题】:Prometheus: PromQL Subtraction, same label, different valuePrometheus:PromQL 减法,相同的标签,不同的值
【发布时间】:2021-07-27 20:30:06
【问题描述】:

我正在使用 Hystrix、千分尺、普罗米修斯。

以下查询有效,但我需要修改它,我不知道如何:

sum by(group, key) (increase(hystrix_execution_total{event="exception_thrown"}[1m])) / sum by(group, key) (increase(hystrix_execution_terminal_total[1m])) * 100 >= 5

基本上exception_thrown 是Hystrix 发出的一个事件,但Hystrix 也发出另一个指标bad_request 表示客户端错误(400)。为了准确衡量上游服务器错误,我需要减去两个具有相同标签但值不同的指标,然后得到每分钟的警报率

hystrix_execution_total{job="auth",key="authenticate",event="exception_thrown"} - hystrix_execution_total{job="auth",key="authenticate",event="bad_request"}

如果有可能实现这一目标,有什么想法吗?

【问题讨论】:

    标签: prometheus grafana hystrix


    【解决方案1】:

    一旦有人指出标签值之间存在超过 1 个差异,忽略就会起作用。

    不仅event标签值不同,terminal标签值也有相应的不同。对于 exception_thrownterminal=true,对于 bad_requestterminal=false[!

    sum by(group, key) (increase(hystrix_execution_total{job="auth",key="authenticate",event="exception_thrown"}[10m]) - ignoring(event, terminal) increase(hystrix_execution_total{job="auth",key="authenticate",event="bad_request"}[10m])) / sum by(group, key) (increase(hystrix_execution_terminal_total[10m])) * 100 >= 5
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-18
      • 1970-01-01
      相关资源
      最近更新 更多