From c53f76f661a98836f824d27d33b5f4b24dfa5bc4 Mon Sep 17 00:00:00 2001
From: Povilas Versockas
Date: Fri, 24 May 2024 15:24:15 +0300
Subject: [PATCH] add k8s.container.status.current_waiting_reason resource
attribute (#997)
Co-authored-by: Chris Mark
Co-authored-by: Joao Grassi <5938087+joaopgrassi@users.noreply.github.com>
---
.chloggen/k8s-waiting-status.yaml | 22 ++++++++++++++++++++++
docs/attributes-registry/k8s.md | 1 +
docs/resource/k8s.md | 1 +
model/registry/k8s.yaml | 7 +++++++
model/resource/k8s.yaml | 1 +
5 files changed, 32 insertions(+)
create mode 100755 .chloggen/k8s-waiting-status.yaml
diff --git a/.chloggen/k8s-waiting-status.yaml b/.chloggen/k8s-waiting-status.yaml
new file mode 100755
index 000000000..850b08930
--- /dev/null
+++ b/.chloggen/k8s-waiting-status.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: "add k8s.container.status.current_waiting_reason resource attribute"
+
+# 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: [996]
+
+# (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 b9bc22533..2bc73fa8e 100644
--- a/docs/attributes-registry/k8s.md
+++ b/docs/attributes-registry/k8s.md
@@ -19,6 +19,7 @@ Kubernetes resource attributes.
| `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. | |  |
+| `k8s.container.status.current_waiting_reason` | string | Current waiting reason of the Container. | `CrashLoopBackOff` |  |
| `k8s.container.status.last_terminated_reason` | string | Last terminated reason of the Container. | `Evicted`; `Error` |  |
| `k8s.cronjob.name` | string | The name of the CronJob. | `opentelemetry` |  |
| `k8s.cronjob.uid` | string | The UID of the CronJob. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` |  |
diff --git a/docs/resource/k8s.md b/docs/resource/k8s.md
index e88759384..458a79fdb 100644
--- a/docs/resource/k8s.md
+++ b/docs/resource/k8s.md
@@ -167,6 +167,7 @@ to a running container.
|---|---|---|---|---|---|
| [`k8s.container.name`](/docs/attributes-registry/k8s.md) | 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`](/docs/attributes-registry/k8s.md) | 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. | | `Recommended` |  |
+| [`k8s.container.status.current_waiting_reason`](/docs/attributes-registry/k8s.md) | string | Current waiting reason of the Container. | `CrashLoopBackOff` | `Recommended` |  |
| [`k8s.container.status.last_terminated_reason`](/docs/attributes-registry/k8s.md) | string | Last terminated reason of the Container. | `Evicted`; `Error` | `Recommended` |  |
diff --git a/model/registry/k8s.yaml b/model/registry/k8s.yaml
index 013ede5c0..e38a1dadf 100644
--- a/model/registry/k8s.yaml
+++ b/model/registry/k8s.yaml
@@ -104,6 +104,13 @@ groups:
brief: >
Last terminated reason of the Container.
examples: ["Evicted", "Error"]
+ - id: container.status.current_waiting_reason
+ type: string
+ stability: experimental
+ brief: >
+ Current waiting reason of the Container.
+ examples: ["CrashLoopBackOff"]
+
- id: replicaset.uid
type: string
stability: experimental
diff --git a/model/resource/k8s.yaml b/model/resource/k8s.yaml
index d94425e00..8a874b152 100644
--- a/model/resource/k8s.yaml
+++ b/model/resource/k8s.yaml
@@ -46,6 +46,7 @@ groups:
- ref: k8s.container.name
- ref: k8s.container.restart_count
- ref: k8s.container.status.last_terminated_reason
+ - ref: k8s.container.status.current_waiting_reason
- id: k8s.replicaset
prefix: k8s.replicaset