Prometheus topk 返回的结果比预期的多 [英] Prometheus topk returns more results than expected

查看:215
本文介绍了Prometheus topk 返回的结果比预期的多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用以下查询

topk(5,sum(container_memory_usage_bytes{kubernetes_container_name=~".+", kubernetes_namespace=~".+"}) by (kubernetes_namespace,kubernetes_container_name))

它返回 5 个预期结果.

it returns 5 results as epxected.

然而与

topk(5,sum(irate(container_cpu_usage_seconds_total{kubernetes_container_name=~".+", kubernetes_namespace=~".+"}[20s])) by (kubernetes_namespace,kubernetes_container_name))

返回大约 18 个结果.知道为什么会这样吗?我需要在第二个查询中更改什么才能只获得前 5 个?

around 18 results are returned. Any idea why this happens? And what I need to change in the second query to get only the top 5?

推荐答案

遇到了同样的问题,我在查询中打开了即时",我得到了正确的金额

Had the same issue, I switched on "Instant" on the query and I got the correct amount back

这篇关于Prometheus topk 返回的结果比预期的多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆