【问题标题】:How to get the rate of duration bucket in promethues after using subtraction使用减法后如何在prometheus中获得持续时间桶的速率
【发布时间】:2021-06-25 10:23:42
【问题描述】:

我试图在减去 2 个存储桶后获得请求持续时间的速率。但是,以下查询返回错误。使用减法后如何获得费率?如果不可能,那我该如何表示呢?

sum(rate(duration_bucker{le="5.0"}  - ignoring(le) duration_bucker{le="1.0"} [1m])) by (data)

错误:"1:96: parse error: binary expression must contain only scalar and instant vector types"

【问题讨论】:

    标签: prometheus promql


    【解决方案1】:

    只需将rate() 函数分别应用于- 操作的左右操作数:

    sum(
      rate(duration_bucker{le="5.0"}[1m]) - ignoring(le)
      rate(duration_bucker{le="1.0"}[1m])
    ) by (data)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-13
      • 2022-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-12
      • 1970-01-01
      相关资源
      最近更新 更多