[k8s] Introduce semantic conventions for k8s StatefulSet labels and annotations (#2169)

Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
This commit is contained in:
odubajDT 2025-04-30 16:33:42 +02:00 committed by GitHub
parent 0246e4513e
commit c9fc9029eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 54 additions and 0 deletions

View File

@ -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:

View File

@ -51,6 +51,8 @@ Kubernetes resource attributes.
| <a id="k8s-replicationcontroller-uid" href="#k8s-replicationcontroller-uid">`k8s.replicationcontroller.uid`</a> | string | The UID of the replication controller. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="k8s-resourcequota-name" href="#k8s-resourcequota-name">`k8s.resourcequota.name`</a> | string | The name of the resource quota. | `opentelemetry` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="k8s-resourcequota-uid" href="#k8s-resourcequota-uid">`k8s.resourcequota.uid`</a> | string | The UID of the resource quota. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="k8s-statefulset-annotation" href="#k8s-statefulset-annotation">`k8s.statefulset.annotation.<key>`</a> | 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) |
| <a id="k8s-statefulset-label" href="#k8s-statefulset-label">`k8s.statefulset.label.<key>`</a> | 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) |
| <a id="k8s-statefulset-name" href="#k8s-statefulset-name">`k8s.statefulset.name`</a> | string | The name of the StatefulSet. | `opentelemetry` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="k8s-statefulset-uid" href="#k8s-statefulset-uid">`k8s.statefulset.uid`</a> | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="k8s-volume-name" href="#k8s-volume-name">`k8s.volume.name`</a> | 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 `<key>` being the label name, the value being the label value, even if the value is empty.
**[15] `k8s.statefulset.annotation`:** The `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
**[16] `k8s.statefulset.label`:** The `<key>` 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.

View File

@ -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.<key>`](/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.<key>`](/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 `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
**[2] `k8s.statefulset.label`:** The `<key>` being the label name, the value being the label value, even if the value is empty.
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

View File

@ -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 `<key>` 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 `<key>` 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

View File

@ -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