diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ed525355d..b194683012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ release. ([#491](https://github.com/open-telemetry/semantic-conventions/pull/491)) - Add gcp_pubsub as a messaging system ([#490](https://github.com/open-telemetry/semantic-conventions/pull/490)) +- 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)) - Add `http.flavor` and `http.user_agent` to list of deprecated attributes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ab5ce406e..0bfa90bc98 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -199,5 +199,24 @@ to merge**. - Send staging tag as PR for review. - Create a tag `v{version}` on the merged PR and push remote. +## Merging existing ECS conventions + +The Elastic Common Schema (ECS) is being merged into OpenTelemetry Semantic +Conventions per [OTEP 222][otep222]. When adding a semantic convention that +exists in some form in ECS, consider the following guidelines: + +- Prefer using the existing ECS name when possible. In particular: + - If proposing a name that differs from the ECS convention, provide usage + data, user issue reports, feature requests, examples of prior work on a + different standard or comparable evidence about the alternatives. + - When no suitable alternatives are provided, altering an ECS name solely + for the purpose of complying with [Name Pluralization guidelines](docs/general/attribute-naming.md#name-pluralization-guidelines) + MAY BE avoided. +- Do not use an existing ECS name as a namespace. If the name must differ, use a + different namespace name to avoid clashes or avoid using the namespace + entirely. See the [ECS field reference] for existing namespaces. + [nvm]: https://github.com/nvm-sh/nvm/blob/master/README.md#installing-and-updating [stability guarantees]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/versioning-and-stability.md#semantic-conventions-stability +[otep222]: https://github.com/open-telemetry/oteps/pull/222 +[ECS field reference]: https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html diff --git a/docs/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index 9becbbf729..56db76720d 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -2,31 +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.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.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` | +| `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 diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md index f5ed62b723..d8f048fe5a 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.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 9c453fb691..e9cecc107e 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.annotation + type: template[string] + brief: > + 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 f0752f0f09..6020d7904f 100644 --- a/model/resource/k8s.yaml +++ b/model/resource/k8s.yaml @@ -34,6 +34,8 @@ groups: - ref: k8s.pod.uid - ref: k8s.pod.name - ref: k8s.pod.labels + - ref: k8s.pod.annotation + requirement_level: opt_in - id: k8s.container prefix: k8s.container