Search code examples
kubernetesprometheusprometheus-operatorprometheus-node-exporter

what provides the metric "container_cpu_usage_seconds_total" to prometheus?


Sorry in advance as this is probably a very easy question to answer, I am pretty new to prometheus and grafana and I am trying to figure out where this metric in prometheus is coming from "container_cpu_usage_seconds_total".

I have found online that all metrics starting with "node_" come from the node exporter pod. So I am just wondering if this metric is coming prometheus itself or is this also coming from the node exporter as we currently have no annotations set on our pods but are getting these metrics inside grafana.

Thanks in advance!


Solution

  • The metric

    container_cpu_usage_seconds_total

    comes from cAdvisor service embedded in kubelet, exposed through port 10250 and endpoint /metrics/cadvisor.

    The metric's source code definition is in:

    cAdvisor/metrics/prometheus.go