prometheus - 用一个标签对所有计数器求和 - 普罗米修斯
问题描述
大家好,我有一个错误计数器,可以为我提供如下指标,我想获得过去 7 天内每个错误原因的总和。我试过使用增加,但似乎增加功能不支持by/without
运算符,所以我得到的结果包括machine_type
.
如何不包含machine_type
在查询结果中?
{instance="localhost:8000", job="prometheus", reason="Some_reason", machine_type="gpu"}
这就是我尝试过
increase(error_count_total[24h])
的结果是
{instance="localhost:8000", job="prometheus", reason="Some_reason", machine_type="gpu"}: 15
{instance="localhost:8000", job="prometheus", reason="Some_reason", machine_type="cpu"}: 10
我想得到
{instance="localhost:8000", job="prometheus", reason="Some_reason"}: 25
解决方案
尝试以下查询:
sum without (machine_type) (increase(error_count_total[24h]))
推荐阅读
- javascript - 如何在对象数组中取消转义 json.stringify 输出
- factor-lang - 将序列解构为词法变量
- postgresql - 插入和无效几何 PostGIS
- android - Android 9 解锁屏幕后冻结 ui
- google-cloud-platform - GCP - 使用 Google Cloud SDK 跨项目移动虚拟机
- mysql - SELECT 查询,每行的列数可变
- javascript - 在 for 循环中,i 变量每次通过循环都是不同的
- javascript - Mongoose Aggregate 如何对同一集合中的 2 个数组中的 2 个对象求和
- javascript - React Router 重定向时的动画过渡
- android - 收货人未到达