grafana - Prometheus 查询总和不适用于不同的事件
问题描述
我有这个命令的 hystrix 指标:
hystrix_execution_total
看起来像这样:
hystrix_execution_total{event="thread_pool_rejected", key="myapp"}
hystrix_execution_total{event="timeout", key="myapp"}
hystrix_execution_total{event="failure", key="myapp"}
hystrix_execution_total{event="success", key="myapp"}
它们都有一些价值。
我想从超时和失败中得到总和,但我遇到了问题。
hystrix_execution_total{event="timeout", key="myapp"} + hystrix_execution_total{event="failure", key="myapp"}
当我执行此操作时,我没有数据。
但是当我将事件更改为超时或失败时,我得到了总和。
那么为什么我不能得到不同事件的总和呢?
解决方案
这是因为 Prometheus 期望表达式两侧的标签匹配。你可以这样做:
hystrix_execution_total{event="timeout", key="myapp"} + ignoring(event)
hystrix_execution_total{event="failure", key="myapp"}
推荐阅读
- typescript - 'string | 类型的 Typescript 错误参数 number' 不可分配给“从不”类型的参数
- java - Java PreparedStatement 函数 uuid_generate_v4() 不存在问题
- c++ - 模板模板参数
- python - 控制 QTreeView header 中网格线和边框的显示
- javascript - 连接具有相似值的二维数组中的元素
- python - OpenCV RGB2HSV 颜色空间转换给出错误的结果,颜色不相似
- javascript - 如何动画网球从水平表面反弹
- google-api - Google Classroom API 列出没有注册码的课程?
- jwt - 如何使用 Auto-Auth 设置 Vault JWT 身份验证?
- angular - 焦点不是从身体角度可访问性开始