From baab3a02433c2774f93f83bd07ad54915ef842c0 Mon Sep 17 00:00:00 2001 From: Christos Markou Date: Thu, 29 May 2025 18:20:28 +0300 Subject: [PATCH] Add k8s.container.ready metric (#2197) Signed-off-by: ChrsMark --- .chloggen/add_k8s_container_ready.yaml | 22 ++++++++++++++++++++++ docs/non-normative/k8s-migration.md | 2 ++ model/k8s/metrics.yaml | 14 ++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 .chloggen/add_k8s_container_ready.yaml diff --git a/.chloggen/add_k8s_container_ready.yaml b/.chloggen/add_k8s_container_ready.yaml new file mode 100644 index 000000000..1ccdf8bde --- /dev/null +++ b/.chloggen/add_k8s_container_ready.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.ready metric + +# 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: [2074] + +# (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/non-normative/k8s-migration.md b/docs/non-normative/k8s-migration.md index 03ce623c5..1c34e6374 100644 --- a/docs/non-normative/k8s-migration.md +++ b/docs/non-normative/k8s-migration.md @@ -292,6 +292,7 @@ receiver were introduced as semantic conventions in: - [#2178](https://github.com/open-telemetry/semantic-conventions/pull/2178) (TODO: replace with SemConv version once available) - [#2074](https://github.com/open-telemetry/semantic-conventions/issues/2074) +- [#2197](https://github.com/open-telemetry/semantic-conventions/issues/2197) The changes in their metrics are the following: @@ -308,5 +309,6 @@ The changes in their metrics are the following: | `k8s.container.ephemeralstorage_limit` | `k8s.container.ephemeral_storage.limit` | | `k8s.container.ephemeralstorage_request` | `k8s.container.ephemeral_storage.request` | | `k8s.container.restarts` (type: `gauge`) | `k8s.container.restart.count` (type: `updowncounter`) | +| `k8s.container.ready` (type: `gauge`) | `k8s.container.ready` (type: `updowncounter`) | diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index 73e48c668..3d126abc7 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -602,3 +602,17 @@ groups: It is best to not depend too much on the exact value but rather look at it as either == 0, in which case you can conclude there were no restarts in the recent past, or > 0, in which case you can conclude there were restarts in the recent past, and not try and analyze the value beyond that. + - id: metric.k8s.container.ready + type: metric + metric_name: k8s.container.ready + stability: development + brief: > + Indicates whether the container is currently marked as ready to accept traffic, + based on its readiness probe (1 = ready, 0 = not ready) + instrument: updowncounter + unit: "{container}" + entity_associations: + - k8s.container + note: | + This metric SHOULD reflect the value of the `ready` field in the + [K8s ContainerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatus-v1-core).