按聚合返回的度量值分组
我正在按组(实例
)获取度量(阶段
)的最大值,然后我想按最大阶段显示实例数是多少。
在 SQL 中,这将是:
select max_stage, count(*)
from
(select instance, max(stage) as max_stage
from table
group by instance
) x
group by
max_stage
使用 PromQL,这不起作用:
count by (stage) ((max by (instance) (stage)))
如何在外部聚合中引用最大阶段?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
count_values
而不是count
:https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
Use
count_values
instead ofcount
:https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators