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
Cadvisor exposes redundant Prometheus metrics with different labels #2092
Comments
can you post the duplicate metrics? |
Ah, you have found metrics for the pod's cgroup as well. The top one is container metrics, and the bottom is pod metrics. |
Thanks @dashpole. |
Since you are using the cAdvisor embedded in kubernetes, no. But you can always filter for a metric that has a non-empty container name. |
Hi @dashpole , does cadvisor always expose pod cgroup metrics? I recently found these metrics in my v1.12.3 k8s cluster. But I haven't seen them with v1.10.x k8s or older. |
cAdvisor exposes metrics for all cgroups on the node, so the pod cgroup metrics should exist in all versions of cAdvisor. |
But I'm pretty sure the metrics I got from kubelet cadvisor endpoint, didn't contain pod cgroup metrics. Maybe due to kubelet code change? I will look deeper when I got time. |
Hi @caitong93, i use Kubernetes v1.11 |
This was added in kubernetes/kubernetes#63406. This was a change made in the kubelet, rather than in cAdvisor. |
container_memory_usage_bytes{container_name!="POD", container_name!=""}
or just container_memory_usage_bytes{container_name!~"POD|"} |
I scraped metrics from Cadvisor with the following scrape job:
As i monitored e.g. the metric container_cpu_usage_seconds_total with the Query: container_cpu_usage_seconds_total{pod_name="your-pod-name"} on the UI, i recognized two redundant results.
The difference between the two redundant metrics are only the labels.
The "id" in the first metric is longer than in the second one. In addition to that, the second metric has no "container_name", "image" and "name" label.
The float values of the two versions have a minimal deviation. In my opinion, this is caused by the different scrape times (one metrics gets scraped milliseconds before the other).
Does anybody know, why there are exposed two redundant metrics? Or is it still a bug?
The text was updated successfully, but these errors were encountered: