promql查询不起作用&quot“ cpu_usage_value或memory_usage_value”

发布于 2025-02-05 17:27:17 字数 182 浏览 2 评论 0 原文

根据Prometheus doc:

vector1或vector2的统计,将导致一个载体,该向量包含Vector1的所有原始元素(标签集 +值)以及vector2的所有元素,它们在vector1中没有匹配的标签集

但上述查​​询仅返回CPU_USAGE_VALUE

PROMPENKER,赦免如果理解错误

according to prometheus doc :

vector1 or vector2 results in a vector that contains all original elements (label sets + values) of vector1 and additionally all elements of vector2 which do not have matching label sets in vector1

but the above query only returns cpu_usage_value

promql beginner, pardon if understood the doc wrong

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我入戏太深 2025-02-12 17:27:17

操作员在搜索标签的左侧时未考虑度量名称。参见这些文档

有以下解决方案:

  1. 明确提及 __ name __ label(aka metric name)在标签列表中,应在其标签匹配序列时考虑到这些标签: foo或在(__ name __)bar 将返回 foo bar names。

  2. {__ name __ =〜“ foo | bar”} 返回系列, foo bar bar names。


  3. 使用 Union> Union 功能来自MetricsQl: in code> in ocy> in ocy> in ocy> in ofcod> in ocy> in of code> in of code> inover(foo,bar bar bar bar bar bar bar bar bar bar )带有 foo bar 名称的系列。请注意,该解决方案仅在Victoriametrics(我使用的类似Prometheus的系统)中起作用。它在Prometheus中不起作用:(

The or operator doesn't take into account metric names when searching for time series on the left side of or with labelsets, which are missing in time series on the right side of or. See these docs.

There are the following solutions:

  1. To explicitly mention __name__ label (aka metric name) in the list of labels, which should be taken into account when matching series by their labelsets: foo or on(__name__) bar would return series with both foo and bar names.

  2. To enumerate the needed metric names in series selector regexp: {__name__=~"foo|bar"} returns series with both foo and bar names.

  3. To use union function from MetricsQL: union(foo, bar) returns series with foo and bar names. Note that this solution works only in VictoriaMetrics (Prometheus-like system I work on). It doesn't work in Prometheus :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文