From c9fc9029eb7981768819241cfb7ec9bb69ca4da0 Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Wed, 30 Apr 2025 16:33:42 +0200 Subject: [PATCH] [k8s] Introduce semantic conventions for k8s StatefulSet labels and annotations (#2169) Signed-off-by: odubajDT --- .../statefulsets-labels-annotations.yaml | 22 +++++++++++++++++++ docs/attributes-registry/k8s.md | 6 +++++ docs/resource/k8s.md | 6 +++++ model/k8s/registry.yaml | 16 ++++++++++++++ model/k8s/resources.yaml | 4 ++++ 5 files changed, 54 insertions(+) create mode 100644 .chloggen/statefulsets-labels-annotations.yaml diff --git a/.chloggen/statefulsets-labels-annotations.yaml b/.chloggen/statefulsets-labels-annotations.yaml new file mode 100644 index 000000000..b9ae2a113 --- /dev/null +++ b/.chloggen/statefulsets-labels-annotations.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: "Introduce semantic conventions for k8s StatefulSet labels and annotations" + +# 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: [2135] + +# (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/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index a4281a2eb..60ad07406 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -51,6 +51,8 @@ Kubernetes resource attributes. | `k8s.replicationcontroller.uid` | string | The UID of the replication controller. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) | | `k8s.resourcequota.name` | string | The name of the resource quota. | `opentelemetry` | ![Development](https://img.shields.io/badge/-development-blue) | | `k8s.resourcequota.uid` | string | The UID of the resource quota. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) | +| `k8s.statefulset.annotation.` | string | The annotation key-value pairs placed on the StatefulSet. [15] | `k8s.statefulset.annotation.replicas=1`; `k8s.statefulset.annotation.data=` | ![Development](https://img.shields.io/badge/-development-blue) | +| `k8s.statefulset.label.` | string | The label key-value pairs placed on the StatefulSet. [16] | `k8s.statefulset.label.app=guestbook`; `k8s.statefulset.label.injected=` | ![Development](https://img.shields.io/badge/-development-blue) | | `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` | ![Development](https://img.shields.io/badge/-development-blue) | | `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) | | `k8s.volume.name` | string | The name of the K8s volume. | `volume0` | ![Development](https://img.shields.io/badge/-development-blue) | @@ -140,6 +142,10 @@ conflict. **[14] `k8s.replicaset.label`:** The `` being the label name, the value being the label value, even if the value is empty. +**[15] `k8s.statefulset.annotation`:** The `` being the annotation name, the value being the annotation value, even if the value is empty. + +**[16] `k8s.statefulset.label`:** The `` being the label name, the value being the label value, even if the value is empty. + --- `k8s.namespace.phase` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md index 693bc43a9..3900410e6 100644 --- a/docs/resource/k8s.md +++ b/docs/resource/k8s.md @@ -308,6 +308,12 @@ about the ordering and uniqueness of these Pods. |---|---|---|---|---|---| | [`k8s.statefulset.name`](/docs/attributes-registry/k8s.md) | string | The name of the StatefulSet. | `opentelemetry` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | | [`k8s.statefulset.uid`](/docs/attributes-registry/k8s.md) | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | +| [`k8s.statefulset.annotation.`](/docs/attributes-registry/k8s.md) | string | The annotation key-value pairs placed on the StatefulSet. [1] | `k8s.statefulset.annotation.replicas=1`; `k8s.statefulset.annotation.data=` | `Opt-In` | ![Development](https://img.shields.io/badge/-development-blue) | +| [`k8s.statefulset.label.`](/docs/attributes-registry/k8s.md) | string | The label key-value pairs placed on the StatefulSet. [2] | `k8s.statefulset.label.app=guestbook`; `k8s.statefulset.label.injected=` | `Opt-In` | ![Development](https://img.shields.io/badge/-development-blue) | + +**[1] `k8s.statefulset.annotation`:** The `` being the annotation name, the value being the annotation value, even if the value is empty. + +**[2] `k8s.statefulset.label`:** The `` being the label name, the value being the label value, even if the value is empty. diff --git a/model/k8s/registry.yaml b/model/k8s/registry.yaml index 61d5eac8a..2938c0f8e 100644 --- a/model/k8s/registry.yaml +++ b/model/k8s/registry.yaml @@ -241,6 +241,22 @@ groups: brief: > The name of the StatefulSet. examples: ['opentelemetry'] + - id: k8s.statefulset.label + type: template[string] + stability: development + brief: > + The label key-value pairs placed on the StatefulSet. + note: | + The `` being the label name, the value being the label value, even if the value is empty. + examples: ['k8s.statefulset.label.app=guestbook', 'k8s.statefulset.label.injected='] + - id: k8s.statefulset.annotation + type: template[string] + stability: development + brief: > + The annotation key-value pairs placed on the StatefulSet. + note: | + The `` being the annotation name, the value being the annotation value, even if the value is empty. + examples: [ 'k8s.statefulset.annotation.replicas=1', 'k8s.statefulset.annotation.data=' ] - id: k8s.daemonset.uid type: string stability: development diff --git a/model/k8s/resources.yaml b/model/k8s/resources.yaml index 0c9b959c2..63dad0bed 100644 --- a/model/k8s/resources.yaml +++ b/model/k8s/resources.yaml @@ -94,6 +94,10 @@ groups: attributes: - ref: k8s.statefulset.uid - ref: k8s.statefulset.name + - ref: k8s.statefulset.label + requirement_level: opt_in + - ref: k8s.statefulset.annotation + requirement_level: opt_in - id: resource.k8s.daemonset type: resource