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

DOCS-10359: kubernetes cpu usage faq #28199

Merged
merged 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/en/containers/faq/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ disable_sidebar: true
{{< nextlink href="agent/faq/docker-hub" >}}Docker Hub{{< /nextlink >}}
{{< nextlink href="containers/faq/build_cluster_agent" >}}How do I build the Cluster Agent?{{< /nextlink >}}
{{< nextlink href="containers/faq/package-server-manager-openshift" >}}Errors during OpenShift upgrade with custom SCCs{{< /nextlink >}}
{{< nextlink href="containers/faq/cpu-usage-metrics" >}}Discrepancies in `kubernetes.cpu.*` and `container.cpu.*` metrics{{< /nextlink >}}
{{< /whatsnext >}}
11 changes: 11 additions & 0 deletions content/en/containers/faq/cpu-usage-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Discrepancies in Kubernetes CPU Usage Metrics
---

As you analyze the CPU usage metrics that Datadog collects from your Kubernetes infrastructure, you may notice discrepancies between Kubernetes metrics (`kubernetes.cpu.*`) and container runtime metrics (`container.cpu.*`).

The Datadog Agent collects its metrics from a variety of sources. To collect `kubernetes.*` metrics, the Datadog Agent makes requests to the kubelet on the same node at a variety of endpoints. These are calculated relative to the metrics that cAdvisor has itself collected and exposed as OpenMetrics formatted data. Specifically, the Agent collects `kubernetes.cpu.*` metrics from `/metrics/cadvisor`. CPU measurements are relative to the monotonically increasing counter for CPU time used per container. The Agent's rate calculations use a slightly different timestamp for the exposed data than the actual timestamp.

Meanwhile, Datadog collects container metrics (such as `container.*` and `docker.*`) by communicating with the container runtime sockets and raw cgroup files. These metrics are not impacted by the timestamp discrepancy.

For the most precision, refer to `container.cpu.*` metrics over `kubernetes.cpu.*` metrics.
5 changes: 4 additions & 1 deletion content/en/containers/kubernetes/data_collected.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ This page lists data collected by the Datadog Agent when deployed on a Kubernete

{{< get-metrics-from-git "kubernetes" >}}

**Note**: For more information about `kubernetes.cpu.*` metrics, see [Discrepancies in `kubernetes.cpu.*` and `container.cpu.*` metrics][8].

### Kubelet

For more information, see the documentation for the [Kubelet][1] integration.
Expand Down Expand Up @@ -178,4 +180,5 @@ For more information, see the documentation for the [Kubernetes state metrics co
[4]: /integrations/kube_metrics_server
[5]: /integrations/kube_scheduler
[6]: /integrations/kubernetes_state_core/
[7]: /agent/troubleshooting/windows_containers/#limited-metrics-for-windows-deployments
[7]: /agent/troubleshooting/windows_containers/#limited-metrics-for-windows-deployments
[8]: /containers/faq/cpu-usage-metrics
Loading