Skip to content

Commit 73550a3

Browse files
Add attribute for k8s pod annotations (#573)
Signed-off-by: ChrsMark <chrismarkou92@gmail.com> Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com>
1 parent 165dae5 commit 73550a3

File tree

5 files changed

+36
-25
lines changed

5 files changed

+36
-25
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ release.
3333

3434
- Adds `labels` attribute to `k8s.pod` resource
3535
([#494](https://github.com/open-telemetry/semantic-conventions/pull/494))
36+
- Adds `annotation` attribute to `k8s.pod` resource
37+
([#494](https://github.com/open-telemetry/semantic-conventions/pull/573))
3638
- Add `code.stacktrace` attribute
3739
([#435](https://github.com/open-telemetry/semantic-conventions/pull/435))
3840
- Add `http.flavor` and `http.user_agent` to list of deprecated attributes

docs/attributes-registry/k8s.md

+26-25
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,32 @@
22

33
## Kubernetes Resource Attributes
44

5-
<!-- semconv registry.k8s -->
6-
| Attribute | Type | Description | Examples | Requirement Level |
7-
|---|---|---|---|---|
8-
| `k8s.cluster.name` | string | The name of the cluster. | `opentelemetry-cluster` | Recommended |
9-
| `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 |
10-
| `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 |
11-
| `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 |
12-
| `k8s.cronjob.name` | string | The name of the CronJob. | `opentelemetry` | Recommended |
13-
| `k8s.cronjob.uid` | string | The UID of the CronJob. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
14-
| `k8s.daemonset.name` | string | The name of the DaemonSet. | `opentelemetry` | Recommended |
15-
| `k8s.daemonset.uid` | string | The UID of the DaemonSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
16-
| `k8s.deployment.name` | string | The name of the Deployment. | `opentelemetry` | Recommended |
17-
| `k8s.deployment.uid` | string | The UID of the Deployment. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
18-
| `k8s.job.name` | string | The name of the Job. | `opentelemetry` | Recommended |
19-
| `k8s.job.uid` | string | The UID of the Job. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
20-
| `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` | Recommended |
21-
| `k8s.node.name` | string | The name of the Node. | `node-1` | Recommended |
22-
| `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` | Recommended |
23-
| `k8s.pod.labels.<key>` | string | The labels placed on the Pod, the `<key>` 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 |
24-
| `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended |
25-
| `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
26-
| `k8s.replicaset.name` | string | The name of the ReplicaSet. | `opentelemetry` | Recommended |
27-
| `k8s.replicaset.uid` | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
28-
| `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` | Recommended |
29-
| `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |
5+
<!-- semconv registry.k8s(omit_requirement_level) -->
6+
| Attribute | Type | Description | Examples |
7+
|---|---|---|---|
8+
| `k8s.cluster.name` | string | The name of the cluster. | `opentelemetry-cluster` |
9+
| `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` |
10+
| `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` |
11+
| `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` |
12+
| `k8s.cronjob.name` | string | The name of the CronJob. | `opentelemetry` |
13+
| `k8s.cronjob.uid` | string | The UID of the CronJob. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
14+
| `k8s.daemonset.name` | string | The name of the DaemonSet. | `opentelemetry` |
15+
| `k8s.daemonset.uid` | string | The UID of the DaemonSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
16+
| `k8s.deployment.name` | string | The name of the Deployment. | `opentelemetry` |
17+
| `k8s.deployment.uid` | string | The UID of the Deployment. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
18+
| `k8s.job.name` | string | The name of the Job. | `opentelemetry` |
19+
| `k8s.job.uid` | string | The UID of the Job. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
20+
| `k8s.namespace.name` | string | The name of the namespace that the pod is running in. | `default` |
21+
| `k8s.node.name` | string | The name of the Node. | `node-1` |
22+
| `k8s.node.uid` | string | The UID of the Node. | `1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2` |
23+
| `k8s.pod.annotation.<key>` | string | The annotation key-value pairs placed on the Pod, the `<key>` 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=` |
24+
| `k8s.pod.labels.<key>` | string | The labels placed on the Pod, the `<key>` 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=` |
25+
| `k8s.pod.name` | string | The name of the Pod. | `opentelemetry-pod-autoconf` |
26+
| `k8s.pod.uid` | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
27+
| `k8s.replicaset.name` | string | The name of the ReplicaSet. | `opentelemetry` |
28+
| `k8s.replicaset.uid` | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
29+
| `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` |
30+
| `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |
3031

3132
**[1]:** K8s doesn't have support for obtaining a cluster ID. If this is ever
3233
added, we will recommend collecting the `k8s.cluster.uid` through the

docs/resource/k8s.md

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ containers on your cluster.
9191
<!-- semconv k8s.pod -->
9292
| Attribute | Type | Description | Examples | Requirement Level |
9393
|---|---|---|---|---|
94+
| [`k8s.pod.annotation.<key>`](../attributes-registry/k8s.md) | string | The annotation key-value pairs placed on the Pod, the `<key>` 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 |
9495
| [`k8s.pod.labels.<key>`](../attributes-registry/k8s.md) | string | The labels placed on the Pod, the `<key>` 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 |
9596
| [`k8s.pod.name`](../attributes-registry/k8s.md) | string | The name of the Pod. | `opentelemetry-pod-autoconf` | Recommended |
9697
| [`k8s.pod.uid`](../attributes-registry/k8s.md) | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | Recommended |

model/registry/k8s.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ groups:
6969
brief: >
7070
The labels placed on the Pod, the `<key>` being the label name, the value being the label value.
7171
examples: ['k8s.pod.labels.app=my-app', 'k8s.pod.labels.mycompany.io/arch=x64', 'k8s.pod.labels.data=']
72+
- id: pod.annotation
73+
type: template[string]
74+
brief: >
75+
The annotation key-value pairs placed on the Pod, the `<key>` being the annotation name, the value being the annotation value.
76+
examples: [ 'k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets=true', 'k8s.pod.annotation.mycompany.io/arch=x64', 'k8s.pod.annotation.data=' ]
7277
- id: container.name
7378
type: string
7479
brief: >

model/resource/k8s.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ groups:
3434
- ref: k8s.pod.uid
3535
- ref: k8s.pod.name
3636
- ref: k8s.pod.labels
37+
- ref: k8s.pod.annotation
38+
requirement_level: opt_in
3739

3840
- id: k8s.container
3941
prefix: k8s.container

0 commit comments

Comments
 (0)