【问题标题】:Prometheus query for metrics generation用于度量生成的 Prometheus 查询
【发布时间】:2019-12-09 23:06:05
【问题描述】:

我正在使用 Prometheus 收集指标,特别是从我的服务到各种路由的传出请求的直方图。

这是一个指标示例:

southbound_request_duration_seconds_bucket{le="0.05",target="api.token-machine.fra.co",method="GET",route="http://api.token-machine.fra.co/states",status_code="200",type="total"} 96

我希望按路由和延迟百分位数显示在 grafana 指标中。

这是我写的查询:

histogram_quantile(0.90 , sum(rate(southbound_request_duration_seconds_bucket{marathon_app_path=~"$instance_path", route=~"$route", env="mars"}[1d])) by (route))

但由于某种原因,我没有生成任何数据。如果我更换

by (route)

   by (le)

它生成数据,但每个百分位数出现 3 次(每条路线一个),但它不显示实际路线。

请指教。

【问题讨论】:

    标签: grafana prometheus


    【解决方案1】:

    你想要:

    histogram_quantile(0.90 , sum by (route, le) (rate(southbound_request_duration_seconds_bucket{marathon_app_path=~"$instance_path", route=~"$route", env="mars"}[1d])))
    

    这样le 被保留为 histogram_quantile,并且它也被路由分解。

    【讨论】:

    • 试了查询,结果和以前一样。
    猜你喜欢
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多