【问题标题】:How do I show the count of a specific group of metrics from a prometheus histogram?如何从普罗米修斯直方图中显示一组特定指标的计数?
【发布时间】:2017-06-23 16:24:36
【问题描述】:

所以,我有一个直方图,它以秒为单位收集某些操作的持续时间,指标是:

  • rpc_request_duration_seconds_bucket
  • rpc_request_duration_seconds_count
  • rpc_request_duration_seconds_sum

这行得通,我得到了分位数,但我想计算所有超过 1 秒的请求。如何生成这样的查询?

【问题讨论】:

    标签: prometheus


    【解决方案1】:
    rate(rpc_request_duration_seconds_bucket{le="+Inf"}[1m]) 
      - ignoring(le)
    rate(rpc_request_duration_seconds_bucket{le="1.0"}[1m])
    

    将返回每秒有多少查询超过 1 秒。

    这是所有查询,减去耗时小于或等于一秒的查询。

    【讨论】:

      【解决方案2】:

      你想写类似的东西

      rate(rpc_request_duration_seconds_count [1m])
      

      这将在 1 分钟(滑动)间隔内为您提供每秒请求数。请参阅 Prometheus 的 Query functions 文档。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-01-10
        • 2020-11-12
        • 1970-01-01
        • 2021-02-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-12-22
        相关资源
        最近更新 更多