From 56324435d12890a2cc0c2cab4f9da62a86d2a851 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 11 Nov 2025 16:30:26 +0100 Subject: [PATCH 1/5] [CONTINT-4835]: Improve documentation wrt CR metric collection Clarify how RBAC is setup. Clarify how metric names are produced. --- .../containers/configuration.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/content/en/infrastructure/containers/configuration.md b/content/en/infrastructure/containers/configuration.md index a4dfa3fa234da..ef64eccf42d98 100644 --- a/content/en/infrastructure/containers/configuration.md +++ b/content/en/infrastructure/containers/configuration.md @@ -413,7 +413,9 @@ field#status.conditions.HorizontalAbleToScale.status:"False" ### Collect custom resource metrics using Kubernetes State Core check -
This functionality requires Cluster Agent 7.63.0+.
+
+ This functionality requires Cluster Agent 7.63.0+ and Operator v1.20+. +
You can use the `kubernetes_state_core` check to collect custom resource metrics when running the Datadog Cluster Agent. @@ -430,6 +432,7 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics crd_type: "eniconfig" labelsFromPath: crd_name: [metadata, name] + metricNamePrefix: "userPrefix" metrics: - name: "eniconfig" help: "ENI Config" @@ -455,8 +458,18 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics path: [metadata, generation] ``` + By default RBAC is setup using groupVersionKinds `kind` by adding `s` suffix. + You can override this behavior by providing **pluralized** `resource` name. + In the example above `CNINode` has `resource: "cninode-pluralized"` overridden. + + Metric names produced using the following rules: + + a. No prefix precified: `kubernetes_state_customresource.` + + b. Prefix precified: `kubernetes_state_customresource._` + For more details, see [Custom Resource State Metrics][5]. - + 2. Update your Helm or Datadog Operator configuration: {{< tabs >}} @@ -514,7 +527,7 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics {{% /tab %}} {{< /tabs >}} - + ## Further reading {{< partial name="whats-next/whats-next.html" >}} From 204ccbb24342b0b8d8530a9bb4a8fa525afef7a4 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 11 Nov 2025 16:59:13 +0100 Subject: [PATCH 2/5] Fix after review --- content/en/infrastructure/containers/configuration.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/en/infrastructure/containers/configuration.md b/content/en/infrastructure/containers/configuration.md index ef64eccf42d98..a476b64ab711c 100644 --- a/content/en/infrastructure/containers/configuration.md +++ b/content/en/infrastructure/containers/configuration.md @@ -413,9 +413,7 @@ field#status.conditions.HorizontalAbleToScale.status:"False" ### Collect custom resource metrics using Kubernetes State Core check -
- This functionality requires Cluster Agent 7.63.0+ and Operator v1.20+. -
+
This functionality requires Cluster Agent 7.63.0+.
You can use the `kubernetes_state_core` check to collect custom resource metrics when running the Datadog Cluster Agent. @@ -496,6 +494,10 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics {{% /tab %}} {{% tab "Datadog Operator" %}} +
+ This functionality requires Agent Operator v1.20+. +
+ 1. Install the Datadog Operator with an option that grants the Datadog Agent permission to collect custom resources: ``` From 74f09c0267c232c74c36e3d683811b4fd47b7fb1 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 11 Nov 2025 12:18:46 -0500 Subject: [PATCH 3/5] Update content/en/infrastructure/containers/configuration.md Co-authored-by: Ida Adjivon <65119712+iadjivon@users.noreply.github.com> --- content/en/infrastructure/containers/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/infrastructure/containers/configuration.md b/content/en/infrastructure/containers/configuration.md index a476b64ab711c..0e8758653a74b 100644 --- a/content/en/infrastructure/containers/configuration.md +++ b/content/en/infrastructure/containers/configuration.md @@ -460,7 +460,7 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics You can override this behavior by providing **pluralized** `resource` name. In the example above `CNINode` has `resource: "cninode-pluralized"` overridden. - Metric names produced using the following rules: + Metric names are produced using the following rules: a. No prefix precified: `kubernetes_state_customresource.` From 4288d4e54ac3d046d203a96c031342baeb346524 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 11 Nov 2025 12:19:32 -0500 Subject: [PATCH 4/5] Update content/en/infrastructure/containers/configuration.md Co-authored-by: Ida Adjivon <65119712+iadjivon@users.noreply.github.com> --- content/en/infrastructure/containers/configuration.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en/infrastructure/containers/configuration.md b/content/en/infrastructure/containers/configuration.md index 0e8758653a74b..9a7440c812be1 100644 --- a/content/en/infrastructure/containers/configuration.md +++ b/content/en/infrastructure/containers/configuration.md @@ -456,9 +456,7 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics path: [metadata, generation] ``` - By default RBAC is setup using groupVersionKinds `kind` by adding `s` suffix. - You can override this behavior by providing **pluralized** `resource` name. - In the example above `CNINode` has `resource: "cninode-pluralized"` overridden. + By default, RBAC and API resource names are derived from the kind in groupVersionKind by converting it to lowercase and adding an “s” suffix (for example, Kind: ENIConfig → eniconfigs). If the Custom Resource Definition (CRD) uses a different plural form, you can override this behavior by specifying the resource field. In the example above, CNINode overrides the default by setting resource: "cninode-pluralized". Metric names are produced using the following rules: From e2e28bdb52838b4425a79ec1b2524085cbf11152 Mon Sep 17 00:00:00 2001 From: Ida Adjivon <65119712+iadjivon@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:03:11 -0500 Subject: [PATCH 5/5] Update content/en/infrastructure/containers/configuration.md --- content/en/infrastructure/containers/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/infrastructure/containers/configuration.md b/content/en/infrastructure/containers/configuration.md index 9a7440c812be1..8c96cac151454 100644 --- a/content/en/infrastructure/containers/configuration.md +++ b/content/en/infrastructure/containers/configuration.md @@ -456,7 +456,7 @@ You can use the `kubernetes_state_core` check to collect custom resource metrics path: [metadata, generation] ``` - By default, RBAC and API resource names are derived from the kind in groupVersionKind by converting it to lowercase and adding an “s” suffix (for example, Kind: ENIConfig → eniconfigs). If the Custom Resource Definition (CRD) uses a different plural form, you can override this behavior by specifying the resource field. In the example above, CNINode overrides the default by setting resource: "cninode-pluralized". + By default, RBAC and API resource names are derived from the kind in groupVersionKind by converting it to lowercase, and adding an "s" suffix (for example, Kind: ENIConfig → eniconfigs). If the Custom Resource Definition (CRD) uses a different plural form, you can override this behavior by specifying the resource field. In the example above, CNINode overrides the default by setting resource: "cninode-pluralized". Metric names are produced using the following rules: