Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I retrieve a set of metrics #2161

Closed
mqliang opened this Issue Nov 4, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@mqliang
Copy link

mqliang commented Nov 4, 2016

I use prometheus to collect monitoring information for kubernetes. And my profiling tool need to retrieve metrics for a set of pod, for example: all "container_cpu_usage_seconds_total" metrics with labels "kubernetes_pod_name=foo" or "kubernetes_pod_name=bar".

Is there anyway I can retrieve all the metrics I need with only one request?

@tlex

This comment has been minimized.

Copy link

tlex commented Nov 4, 2016

You could use regex:

container_cpu_usage_seconds_total{kubernetes_pod_name=~"(foo|bar).*"}

the =~ selector announces that a regex follows

The second option would be the or operator (allows to get not only the same metric with different labels, but also different metrics all together):

container_cpu_usage_seconds_total{kubernetes_pod_name="foo"} or container_cpu_usage_seconds_total{kubernetes_pod_name="bar"}
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.