From 0599a0606ca3fb4f504b1ecc0af544fc81785aec Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Thu, 5 Dec 2024 11:25:41 +0200 Subject: [PATCH] Add k8s daemonset metrics Signed-off-by: ChrsMark --- .chloggen/add_ds_metrics.yaml | 22 +++++++++ docs/system/k8s-metrics.md | 92 +++++++++++++++++++++++++++++++++++ model/k8s/metrics.yaml | 42 ++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100755 .chloggen/add_ds_metrics.yaml diff --git a/.chloggen/add_ds_metrics.yaml b/.chloggen/add_ds_metrics.yaml new file mode 100755 index 0000000000..d8a68d2311 --- /dev/null +++ b/.chloggen/add_ds_metrics.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: k8s + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add k8s deamonset related metrics + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1649] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index 9187ddf2db..709629148d 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -329,5 +329,97 @@ This metric is [recommended][MetricRecommended]. +### Metric: `k8s.daemonset.current_scheduled_nodes` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.daemonset.current_scheduled_nodes` | Gauge | `{node}` | Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** This metric aligns with the `currentNumberScheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + + + + + + +### Metric: `k8s.daemonset.desired_scheduled_nodes` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.daemonset.desired_scheduled_nodes` | Gauge | `{node}` | Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod) [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** This metric aligns with the `desiredNumberScheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + + + + + + +### Metric: `k8s.daemonset.misscheduled_nodes` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.daemonset.misscheduled_nodes` | Gauge | `{node}` | Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** This metric aligns with the `numberMisscheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + + + + + + +### Metric: `k8s.daemonset.ready_nodes` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.daemonset.ready_nodes` | Gauge | `{node}` | Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** This metric aligns with the `numberReady` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + + + + + + [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status [MetricRecommended]: /docs/general/metric-requirement-level.md#recommended diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index 7afd7ec20d..5b4f7287b8 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -126,3 +126,45 @@ groups: attributes: - ref: network.interface.name - ref: network.io.direction + + # k8s.daemonset.* metrics + - id: metric.k8s.daemonset.current_scheduled_nodes + type: metric + metric_name: k8s.daemonset.current_scheduled_nodes + stability: experimental + brief: "Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod" + note: | + This metric aligns with the `currentNumberScheduled` field of the + [K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + instrument: gauge + unit: "{node}" + - id: metric.k8s.daemonset.desired_scheduled_nodes + type: metric + metric_name: k8s.daemonset.desired_scheduled_nodes + stability: experimental + brief: "Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)" + note: | + This metric aligns with the `desiredNumberScheduled` field of the + [K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + instrument: gauge + unit: "{node}" + - id: metric.k8s.daemonset.misscheduled_nodes + type: metric + metric_name: k8s.daemonset.misscheduled_nodes + stability: experimental + brief: "Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod" + note: | + This metric aligns with the `numberMisscheduled` field of the + [K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + instrument: gauge + unit: "{node}" + - id: metric.k8s.daemonset.ready_nodes + type: metric + metric_name: k8s.daemonset.ready_nodes + stability: experimental + brief: "Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready" + note: | + This metric aligns with the `numberReady` field of the + [K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps) + instrument: gauge + unit: "{node}"