Skip to content

Commit 0d843e4

Browse files
authored
Add k8s daemonset metrics (#1649)
Signed-off-by: ChrsMark <[email protected]>
1 parent b60cdba commit 0d843e4

File tree

4 files changed

+211
-0
lines changed

4 files changed

+211
-0
lines changed

.chloggen/add_ds_metrics.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: enhancement
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: k8s
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Add k8s deamonset related metrics
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [1649]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/non-normative/k8s-migration.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ and one for disabling the old schema called `semconv.k8s.disableLegacy`. Then:
4848
- [K8s ReplicationController metrics](#k8s-replicationcontroller-metrics)
4949
- [K8s StatefulsSet metrics](#k8s-statefulsset-metrics)
5050
- [K8s HorizontalPodAutoscaler metrics](#k8s-horizontalpodautoscaler-metrics)
51+
- [K8s DaemonSet metrics](#k8s-daemonset-metrics)
5152

5253
<!-- tocstop -->
5354

@@ -173,3 +174,24 @@ The changes in their metric names and types are the following:
173174
| `k8s.hpa.min_replicas` (type: `gauge`) | `k8s.hpa.min_pods` (type: `updowncounter`) |
174175

175176
<!-- prettier-ignore-end -->
177+
178+
### K8s DaemonSet metrics
179+
180+
The K8s DaemonSet metrics implemented by the Collector and specifically the
181+
[k8scluster](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.115.0/receiver/k8sclusterreceiver/documentation.md)
182+
receiver were introduced as semantic conventions in
183+
[#1649](https://github.com/open-telemetry/semantic-conventions/pull/1649) (TODO: replace with SemConv version once
184+
available).
185+
186+
The changes in their metric types are the following:
187+
188+
<!-- prettier-ignore-start -->
189+
190+
| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
191+
|------------------------------------------------------------------------------------|-----------------------------------------------------------------|
192+
| `k8s.daemonset.current_scheduled_nodes` (type: `gauge`) | `k8s.daemonset.current_scheduled_nodes` (type: `updowncounter`) |
193+
| `k8s.daemonset.desired_scheduled_nodes` (type: `gauge`) | `k8s.daemonset.desired_scheduled_nodes` (type: `updowncounter`) |
194+
| `k8s.daemonset.misscheduled_nodes` (type: `gauge`) | `k8s.daemonset.misscheduled_nodes` (type: `updowncounter`) |
195+
| `k8s.daemonset.ready_nodes` (type: `gauge`) | `k8s.daemonset.ready_nodes` (type: `updowncounter`) |
196+
197+
<!-- prettier-ignore-end -->

docs/system/k8s-metrics.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`.
5252
- [Metric: `k8s.hpa.current_pods`](#metric-k8shpacurrent_pods)
5353
- [Metric: `k8s.hpa.max_pods`](#metric-k8shpamax_pods)
5454
- [Metric: `k8s.hpa.min_pods`](#metric-k8shpamin_pods)
55+
- [DaemonSet Metrics](#daemonset-metrics)
56+
- [Metric: `k8s.daemonset.current_scheduled_nodes`](#metric-k8sdaemonsetcurrent_scheduled_nodes)
57+
- [Metric: `k8s.daemonset.desired_scheduled_nodes`](#metric-k8sdaemonsetdesired_scheduled_nodes)
58+
- [Metric: `k8s.daemonset.misscheduled_nodes`](#metric-k8sdaemonsetmisscheduled_nodes)
59+
- [Metric: `k8s.daemonset.ready_nodes`](#metric-k8sdaemonsetready_nodes)
5560

5661
<!-- tocstop -->
5762

@@ -743,5 +748,113 @@ This metric is [recommended][MetricRecommended].
743748
<!-- END AUTOGENERATED TEXT -->
744749
<!-- endsemconv -->
745750

751+
## DaemonSet Metrics
752+
753+
**Description:** DaemonSet level metrics captured under the namespace `k8s.daemonset`.
754+
755+
### Metric: `k8s.daemonset.current_scheduled_nodes`
756+
757+
This metric is [recommended][MetricRecommended].
758+
759+
<!-- semconv metric.k8s.daemonset.current_scheduled_nodes -->
760+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
761+
<!-- see templates/registry/markdown/snippet.md.j2 -->
762+
<!-- prettier-ignore-start -->
763+
<!-- markdownlint-capture -->
764+
<!-- markdownlint-disable -->
765+
766+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
767+
| -------- | --------------- | ----------- | -------------- | --------- |
768+
| `k8s.daemonset.current_scheduled_nodes` | UpDownCounter | `{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) |
769+
770+
**[1]:** This metric aligns with the `currentNumberScheduled` field of the
771+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
772+
773+
This metric SHOULD, at a minimum, be reported against a
774+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
775+
776+
<!-- markdownlint-restore -->
777+
<!-- prettier-ignore-end -->
778+
<!-- END AUTOGENERATED TEXT -->
779+
<!-- endsemconv -->
780+
781+
### Metric: `k8s.daemonset.desired_scheduled_nodes`
782+
783+
This metric is [recommended][MetricRecommended].
784+
785+
<!-- semconv metric.k8s.daemonset.desired_scheduled_nodes -->
786+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
787+
<!-- see templates/registry/markdown/snippet.md.j2 -->
788+
<!-- prettier-ignore-start -->
789+
<!-- markdownlint-capture -->
790+
<!-- markdownlint-disable -->
791+
792+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
793+
| -------- | --------------- | ----------- | -------------- | --------- |
794+
| `k8s.daemonset.desired_scheduled_nodes` | UpDownCounter | `{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) |
795+
796+
**[1]:** This metric aligns with the `desiredNumberScheduled` field of the
797+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
798+
799+
This metric SHOULD, at a minimum, be reported against a
800+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
801+
802+
<!-- markdownlint-restore -->
803+
<!-- prettier-ignore-end -->
804+
<!-- END AUTOGENERATED TEXT -->
805+
<!-- endsemconv -->
806+
807+
### Metric: `k8s.daemonset.misscheduled_nodes`
808+
809+
This metric is [recommended][MetricRecommended].
810+
811+
<!-- semconv metric.k8s.daemonset.misscheduled_nodes -->
812+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
813+
<!-- see templates/registry/markdown/snippet.md.j2 -->
814+
<!-- prettier-ignore-start -->
815+
<!-- markdownlint-capture -->
816+
<!-- markdownlint-disable -->
817+
818+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
819+
| -------- | --------------- | ----------- | -------------- | --------- |
820+
| `k8s.daemonset.misscheduled_nodes` | UpDownCounter | `{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) |
821+
822+
**[1]:** This metric aligns with the `numberMisscheduled` field of the
823+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
824+
825+
This metric SHOULD, at a minimum, be reported against a
826+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
827+
828+
<!-- markdownlint-restore -->
829+
<!-- prettier-ignore-end -->
830+
<!-- END AUTOGENERATED TEXT -->
831+
<!-- endsemconv -->
832+
833+
### Metric: `k8s.daemonset.ready_nodes`
834+
835+
This metric is [recommended][MetricRecommended].
836+
837+
<!-- semconv metric.k8s.daemonset.ready_nodes -->
838+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
839+
<!-- see templates/registry/markdown/snippet.md.j2 -->
840+
<!-- prettier-ignore-start -->
841+
<!-- markdownlint-capture -->
842+
<!-- markdownlint-disable -->
843+
844+
| Name | Instrument Type | Unit (UCUM) | Description | Stability |
845+
| -------- | --------------- | ----------- | -------------- | --------- |
846+
| `k8s.daemonset.ready_nodes` | UpDownCounter | `{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) |
847+
848+
**[1]:** This metric aligns with the `numberReady` field of the
849+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
850+
851+
This metric SHOULD, at a minimum, be reported against a
852+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
853+
854+
<!-- markdownlint-restore -->
855+
<!-- prettier-ignore-end -->
856+
<!-- END AUTOGENERATED TEXT -->
857+
<!-- endsemconv -->
858+
746859
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
747860
[MetricRecommended]: /docs/general/metric-requirement-level.md#recommended

model/k8s/metrics.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,57 @@ groups:
306306
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)
307307
instrument: updowncounter
308308
unit: "{pod}"
309+
310+
# k8s.daemonset.* metrics
311+
- id: metric.k8s.daemonset.current_scheduled_nodes
312+
type: metric
313+
metric_name: k8s.daemonset.current_scheduled_nodes
314+
stability: experimental
315+
brief: "Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod"
316+
note: |
317+
This metric aligns with the `currentNumberScheduled` field of the
318+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
319+
320+
This metric SHOULD, at a minimum, be reported against a
321+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
322+
instrument: updowncounter
323+
unit: "{node}"
324+
- id: metric.k8s.daemonset.desired_scheduled_nodes
325+
type: metric
326+
metric_name: k8s.daemonset.desired_scheduled_nodes
327+
stability: experimental
328+
brief: "Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)"
329+
note: |
330+
This metric aligns with the `desiredNumberScheduled` field of the
331+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
332+
333+
This metric SHOULD, at a minimum, be reported against a
334+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
335+
instrument: updowncounter
336+
unit: "{node}"
337+
- id: metric.k8s.daemonset.misscheduled_nodes
338+
type: metric
339+
metric_name: k8s.daemonset.misscheduled_nodes
340+
stability: experimental
341+
brief: "Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod"
342+
note: |
343+
This metric aligns with the `numberMisscheduled` field of the
344+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
345+
346+
This metric SHOULD, at a minimum, be reported against a
347+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
348+
instrument: updowncounter
349+
unit: "{node}"
350+
- id: metric.k8s.daemonset.ready_nodes
351+
type: metric
352+
metric_name: k8s.daemonset.ready_nodes
353+
stability: experimental
354+
brief: "Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready"
355+
note: |
356+
This metric aligns with the `numberReady` field of the
357+
[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps).
358+
359+
This metric SHOULD, at a minimum, be reported against a
360+
[`k8s.daemonset`](../resource/k8s.md#daemonset) resource.
361+
instrument: updowncounter
362+
unit: "{node}"

0 commit comments

Comments
 (0)