在 Prometheus/PromQL 中合并/加入两个指标 [英] Merge/join two metrics in Prometheus/PromQL

查看:533
本文介绍了在 Prometheus/PromQL 中合并/加入两个指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同(但相关的指标).

I have two different (but related metrics).

metric_1(id="abc",id2="def")
metric_2(id="abc",id2="def")

我的最终目标是在 Grafana 中实现以下目标.我计划使用即时"值和 Grafana 的表格可视化小部件来显示这些数据.

My goal ultimately is to have the following in Grafana. I plan to use the "instant" value and Grafana's table visualization widget to display this data.

id      id2     metric1 metric2
abc     def     1       2

我应该使用什么查询/加入/重新标记来实现这一点?

What query/joining/relabeling should I use to achieve this?

先谢谢你!:)

推荐答案

{__name__=~"metric_1|metric_2"}

https://stackoverflow.com/a/47415934/661150https://prometheus.io/docs/prometheus/latest/querying/basics/

这篇关于在 Prometheus/PromQL 中合并/加入两个指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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