From 72245a83bbbf027464f8130be1aafa68c80c2fdf Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Fri, 1 Dec 2023 10:39:16 +0000 Subject: [PATCH 1/6] Add attribute for k8s pod annotations Signed-off-by: ChrsMark --- docs/attributes-registry/k8s.md | 1 + docs/resource/k8s.md | 1 + model/registry/k8s.yaml | 5 +++++ model/resource/k8s.yaml | 1 + 4 files changed, 8 insertions(+) diff --git a/docs/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index 9becbbf729..e873b35631 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -20,6 +20,7 @@ | `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` | Recommended | | `k8s.node.name` | string | The name of the Node. | `node-1` | Recommended | | `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` | Recommended | +| `k8s.pod.annotations.` | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Recommended | | `k8s.pod.labels.` | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | Recommended | | `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended | | `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md index f5ed62b723..dd3c2ebe23 100644 --- a/docs/resource/k8s.md +++ b/docs/resource/k8s.md @@ -91,6 +91,7 @@ containers on your cluster. | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| +| [`k8s.pod.annotations.`](../attributes-registry/k8s.md) | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Recommended | | [`k8s.pod.labels.`](../attributes-registry/k8s.md) | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | Recommended | | [`k8s.pod.name`](../attributes-registry/k8s.md) | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended | | [`k8s.pod.uid`](../attributes-registry/k8s.md) | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | diff --git a/model/registry/k8s.yaml b/model/registry/k8s.yaml index 9c453fb691..b6cca45c4d 100644 --- a/model/registry/k8s.yaml +++ b/model/registry/k8s.yaml @@ -69,6 +69,11 @@ groups: brief: > The labels placed on the Pod, the `` being the label name, the value being the label value. examples: ['k8s.pod.labels.app=my-app', 'k8s.pod.labels.mycompany.io/arch=x64', 'k8s.pod.labels.data='] + - id: pod.annotations + type: template[string] + brief: > + The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. + examples: [ 'k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true', 'k8s.pod.annotations.mycompany.io/arch=x64', 'k8s.pod.annotations.data=' ] - id: container.name type: string brief: > diff --git a/model/resource/k8s.yaml b/model/resource/k8s.yaml index f0752f0f09..c4b314bb4a 100644 --- a/model/resource/k8s.yaml +++ b/model/resource/k8s.yaml @@ -34,6 +34,7 @@ groups: - ref: k8s.pod.uid - ref: k8s.pod.name - ref: k8s.pod.labels + - ref: k8s.pod.annotations - id: k8s.container prefix: k8s.container From 8034826177b69b39acaaf492a0a0ec8fab6b8bae Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Fri, 1 Dec 2023 10:42:03 +0000 Subject: [PATCH 2/6] Add changelog entry Signed-off-by: ChrsMark --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc899cc299..9067eaad63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ release. - Adds `labels` attribute to `k8s.pod` resource ([#494](https://github.com/open-telemetry/semantic-conventions/pull/494)) +- Adds `annotations` attribute to `k8s.pod` resource + ([#494](https://github.com/open-telemetry/semantic-conventions/pull/573)) - Add `code.stacktrace` attribute ([#435](https://github.com/open-telemetry/semantic-conventions/pull/435)) - Add `http.flavor` and `http.user_agent` to list of deprecated attributes From 7649d8fdb062d167886e762c766029825a51d35a Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 4 Dec 2023 09:29:58 +0000 Subject: [PATCH 3/6] Change to opt-in Signed-off-by: ChrsMark --- docs/resource/k8s.md | 2 +- model/resource/k8s.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md index dd3c2ebe23..3b24f35dae 100644 --- a/docs/resource/k8s.md +++ b/docs/resource/k8s.md @@ -91,7 +91,7 @@ containers on your cluster. | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| [`k8s.pod.annotations.`](../attributes-registry/k8s.md) | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Recommended | +| [`k8s.pod.annotations.`](../attributes-registry/k8s.md) | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Opt-In | | [`k8s.pod.labels.`](../attributes-registry/k8s.md) | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | Recommended | | [`k8s.pod.name`](../attributes-registry/k8s.md) | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended | | [`k8s.pod.uid`](../attributes-registry/k8s.md) | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | diff --git a/model/resource/k8s.yaml b/model/resource/k8s.yaml index c4b314bb4a..d1b3fad0e4 100644 --- a/model/resource/k8s.yaml +++ b/model/resource/k8s.yaml @@ -35,6 +35,7 @@ groups: - ref: k8s.pod.name - ref: k8s.pod.labels - ref: k8s.pod.annotations + requirement_level: opt_in - id: k8s.container prefix: k8s.container From 6e7dfcae8426940faf9132bf222ad5d483d32c4a Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 4 Dec 2023 14:05:03 +0000 Subject: [PATCH 4/6] Omit requirement level from k8s registry doc Signed-off-by: ChrsMark --- docs/attributes-registry/k8s.md | 52 ++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index e873b35631..8bc3a4ca41 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -2,32 +2,32 @@ ## Kubernetes Resource Attributes - -| Attribute | Type | Description | Examples | Requirement Level | -|---|---|---|---|---| -| `k8s.cluster.name` | string | The name of the cluster. | `opentelemetry-cluster` | Recommended | -| `k8s.cluster.uid` | string | A pseudo-ID for the cluster, set to the UID of the `kube-system` namespace. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | Recommended | -| `k8s.container.name` | string | The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). | `redis` | Recommended | -| `k8s.container.restart_count` | int | Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. | `0`; `2` | Recommended | -| `k8s.cronjob.name` | string | The name of the CronJob. | `opentelemetry` | Recommended | -| `k8s.cronjob.uid` | string | The UID of the CronJob. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.daemonset.name` | string | The name of the DaemonSet. | `opentelemetry` | Recommended | -| `k8s.daemonset.uid` | string | The UID of the DaemonSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.deployment.name` | string | The name of the Deployment. | `opentelemetry` | Recommended | -| `k8s.deployment.uid` | string | The UID of the Deployment. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.job.name` | string | The name of the Job. | `opentelemetry` | Recommended | -| `k8s.job.uid` | string | The UID of the Job. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` | Recommended | -| `k8s.node.name` | string | The name of the Node. | `node-1` | Recommended | -| `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` | Recommended | -| `k8s.pod.annotations.` | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Recommended | -| `k8s.pod.labels.` | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | Recommended | -| `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended | -| `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.replicaset.name` | string | The name of the ReplicaSet. | `opentelemetry` | Recommended | -| `k8s.replicaset.uid` | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | -| `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` | Recommended | -| `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | + +| Attribute | Type | Description | Examples | +|---|---|---|---| +| `k8s.cluster.name` | string | The name of the cluster. | `opentelemetry-cluster` | +| `k8s.cluster.uid` | string | A pseudo-ID for the cluster, set to the UID of the `kube-system` namespace. [1] | `218fc5a9-a5f1-4b54-aa05-46717d0ab26d` | +| `k8s.container.name` | string | The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). | `redis` | +| `k8s.container.restart_count` | int | Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. | `0`; `2` | +| `k8s.cronjob.name` | string | The name of the CronJob. | `opentelemetry` | +| `k8s.cronjob.uid` | string | The UID of the CronJob. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.daemonset.name` | string | The name of the DaemonSet. | `opentelemetry` | +| `k8s.daemonset.uid` | string | The UID of the DaemonSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.deployment.name` | string | The name of the Deployment. | `opentelemetry` | +| `k8s.deployment.uid` | string | The UID of the Deployment. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.job.name` | string | The name of the Job. | `opentelemetry` | +| `k8s.job.uid` | string | The UID of the Job. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` | +| `k8s.node.name` | string | The name of the Node. | `node-1` | +| `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` | +| `k8s.pod.annotations.` | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | +| `k8s.pod.labels.` | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | +| `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` | +| `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.replicaset.name` | string | The name of the ReplicaSet. | `opentelemetry` | +| `k8s.replicaset.uid` | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | +| `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` | +| `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | **[1]:** K8s doesn't have support for obtaining a cluster ID. If this is ever added, we will recommend collecting the `k8s.cluster.uid` through the From 998e34468957f88cee152a9ec6e0a6db30811a67 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 11 Dec 2023 09:28:30 +0000 Subject: [PATCH 5/6] Change annotations attr to singular Signed-off-by: ChrsMark --- docs/attributes-registry/k8s.md | 2 +- docs/resource/k8s.md | 2 +- model/registry/k8s.yaml | 6 +++--- model/resource/k8s.yaml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index 8bc3a4ca41..56db76720d 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -20,7 +20,7 @@ | `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` | | `k8s.node.name` | string | The name of the Node. | `node-1` | | `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` | -| `k8s.pod.annotations.` | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | +| `k8s.pod.annotation.` | string | The annotation key-value pairs placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotation.mycompany.io/arch=x64`; `k8s.pod.annotation.data=` | | `k8s.pod.labels.` | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | | `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` | | `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md index 3b24f35dae..d8f048fe5a 100644 --- a/docs/resource/k8s.md +++ b/docs/resource/k8s.md @@ -91,7 +91,7 @@ containers on your cluster. | Attribute | Type | Description | Examples | Requirement Level | |---|---|---|---|---| -| [`k8s.pod.annotations.`](../attributes-registry/k8s.md) | string | The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotations.mycompany.io/arch=x64`; `k8s.pod.annotations.data=` | Opt-In | +| [`k8s.pod.annotation.`](../attributes-registry/k8s.md) | string | The annotation key-value pairs placed on the Pod, the `` being the annotation name, the value being the annotation value. | `k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets=true`; `k8s.pod.annotation.mycompany.io/arch=x64`; `k8s.pod.annotation.data=` | Opt-In | | [`k8s.pod.labels.`](../attributes-registry/k8s.md) | string | The labels placed on the Pod, the `` being the label name, the value being the label value. | `k8s.pod.labels.app=my-app`; `k8s.pod.labels.mycompany.io/arch=x64`; `k8s.pod.labels.data=` | Recommended | | [`k8s.pod.name`](../attributes-registry/k8s.md) | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended | | [`k8s.pod.uid`](../attributes-registry/k8s.md) | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended | diff --git a/model/registry/k8s.yaml b/model/registry/k8s.yaml index b6cca45c4d..e9cecc107e 100644 --- a/model/registry/k8s.yaml +++ b/model/registry/k8s.yaml @@ -69,11 +69,11 @@ groups: brief: > The labels placed on the Pod, the `` being the label name, the value being the label value. examples: ['k8s.pod.labels.app=my-app', 'k8s.pod.labels.mycompany.io/arch=x64', 'k8s.pod.labels.data='] - - id: pod.annotations + - id: pod.annotation type: template[string] brief: > - The annotations placed on the Pod, the `` being the annotation name, the value being the annotation value. - examples: [ 'k8s.pod.annotations.kubernetes.io/enforce-mountable-secrets=true', 'k8s.pod.annotations.mycompany.io/arch=x64', 'k8s.pod.annotations.data=' ] + The annotation key-value pairs placed on the Pod, the `` being the annotation name, the value being the annotation value. + examples: [ 'k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets=true', 'k8s.pod.annotation.mycompany.io/arch=x64', 'k8s.pod.annotation.data=' ] - id: container.name type: string brief: > diff --git a/model/resource/k8s.yaml b/model/resource/k8s.yaml index d1b3fad0e4..6020d7904f 100644 --- a/model/resource/k8s.yaml +++ b/model/resource/k8s.yaml @@ -34,7 +34,7 @@ groups: - ref: k8s.pod.uid - ref: k8s.pod.name - ref: k8s.pod.labels - - ref: k8s.pod.annotations + - ref: k8s.pod.annotation requirement_level: opt_in - id: k8s.container From 4e13d9cafe5d0ce264bfd6bbb050cde889873598 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 11 Dec 2023 09:33:10 +0000 Subject: [PATCH 6/6] Update changelog Signed-off-by: ChrsMark --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c32e206b2..f33d9a87fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ release. - Adds `labels` attribute to `k8s.pod` resource ([#494](https://github.com/open-telemetry/semantic-conventions/pull/494)) -- Adds `annotations` attribute to `k8s.pod` resource +- Adds `annotation` attribute to `k8s.pod` resource ([#494](https://github.com/open-telemetry/semantic-conventions/pull/573)) - Add `code.stacktrace` attribute ([#435](https://github.com/open-telemetry/semantic-conventions/pull/435))