加入更多指标
我正在使用IBM Cloud中的Sysdig监视。 我首先要有这两个指标
:
sum by(container_image_repo,container_image_tag) (sysdig_container_cpu_cores_used)
由回购返回并标记总计使用的CPU(in Value_a)
秒:
count by(container_image_repo,container_image_tag)(sysdig_container_info)
哪个返回返回并标记容器总数(在value_b中)
我的问题是我想拥有一个单一请求哪个同时返回两个指标,即回购和标签,即:
repo tag value_a value_b
有任何提示?
我尝试加入两个请求,
sum by(container_image_repo,container_image_tag) (sysdig_container_cpu_cores_used) *on (container_image_repo,container_image_tag) (count by(
container_image_repo,container_image_tag)(sysdig_container_info))
但是我仍然得到一个值(这是由repo和tag分组的两个值A*b的乘法。确实不足为奇...
谢谢您)
I'm using SYSDIG monitoring in IBM Cloud.
I have these two metrics
first:
sum by(container_image_repo,container_image_tag) (sysdig_container_cpu_cores_used)
Which return by repo and tag the total used cpu (in Value_A)
second:
count by(container_image_repo,container_image_tag)(sysdig_container_info)
Which return by repo and tag the total number of containers (in Value_B)
My problem is that I would like to have one single request which returns the two metrics at the same time by repo and tag, i.e.:
Repo Tag Value_A Value_B
Any hints?
I tried joining the two requests,
sum by(container_image_repo,container_image_tag) (sysdig_container_cpu_cores_used) *on (container_image_repo,container_image_tag) (count by(
container_image_repo,container_image_tag)(sysdig_container_info))
but I get still one value (which is the multiplication of the two values A*B, grouped by repo and tag. No surprise indeed...)
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这与Sysdig无关,而与Promql的设计方式有关。在Promql中,当您在向量上应用函数时,所得的向量或标量不包含度量名称(因为这不再是同一度量,而是其导数)。
在您的示例中,您正在使用的这两个指标表示两种不同的内容:
sysdig_container_container_cpu_cores_used
:是特定容器占用sysdig_container_info
的内核数sysdig_container_info
用这些其他标签丰富它。我认为,您的查询为您提供了所需的所有相关信息:
例如
披露:
我在Sysdig担任工程师,但我的答案/评论严格来说是我自己的。
This is not related to Sysdig, but to the way how PromQL is designed. In PromQL, when you apply a function over a vector, the resulting vector or scalar does not contain the metric name (since this is not the same metric anymore, but its derivative).
In your example, these two metrics that you are using denote two different things:
sysdig_container_cpu_cores_used
: is the number of cores a particular container occupiessysdig_container_info
: a set of additional labels for each container. In order not to add all container information to every container metric (such as agent id, container id, the id of the image in the container, image digest value, etc.), when you need it, you can join that container metric withsysdig_container_info
to enrich it with these additional labels.In my opinion, your query gives you all the relevant info you stated you need:
e.g.
Disclosure:
I work as an engineer at Sysdig, but my answers/comments are strictly my own.