如何在prometheus/grafana表中显示大多数失败的http请求?

Pie*_*rre 2 monitoring health-monitoring grafana prometheus

我正在使用prometheus/grafana/express-prom-bundle监视我的nodejs应用程序,它暴露了一个名为http_request_duration_seconds_count的计数器指标.该指标有三个感兴趣的标签.status_code,路径和方法.

我想在我的grafana仪表板中显示一个表,列出仪表板日期范围内最常见的失败路径/方法(status_code ="500").

是可能的,如果是这样,我需要实现此列表的prometheus查询和grafana表设置.

预先感谢您的帮助.

bri*_*zil 5

在这里你想要topk聚合器,所以

topk(5, 
  sum by (method, path) (
    rate(http_request_duration_seconds_count{status_code="500"}[5m])
  )
)
Run Code Online (Sandbox Code Playgroud)