假设我在 prometheus 中有两个指标,都是计数器:
requests_processed_total
requests_failed_total
它们都有匹配的 service
标签。示例:
requests_processed_total{service="news"} 1097
requests_processed_total{service="store"} 487
requests_failed_total{service="news"} 23
requests_failed_total{service="store"} 89
如何查询requests_failed_total
,但仅限于request_processed_total > 1000
的服务。
我期待以下响应:
requests_failed_total{service="news"} 23
# Note that the "store" service is excluded
最佳答案
requests_failed_total 和 on(service) requests_processed_total > 1000
https://prometheus.io/docs/prometheus/latest/querying/operators/#logical-set-binary-operators https://prometheus.io/docs/prometheus/latest/querying/operators/#one-to-one-vector-matches
关于monitoring - Prometheus:根据另一个指标过滤查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63134892/