From bfa427fad91e54904a4edfd74509572aafe868d1 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Wed, 29 Jan 2025 11:16:33 +0200 Subject: [PATCH] Make replication controller metrics consistent with resource attributes Signed-off-by: ChrsMark --- .chloggen/fix_k8s_metrics.yaml | 22 ++++++++++++++++++++++ docs/non-normative/k8s-migration.md | 8 ++++---- docs/system/k8s-metrics.md | 18 +++++++++--------- model/k8s/metrics.yaml | 10 +++++----- schema-next.yaml | 5 +++++ 5 files changed, 45 insertions(+), 18 deletions(-) create mode 100755 .chloggen/fix_k8s_metrics.yaml diff --git a/.chloggen/fix_k8s_metrics.yaml b/.chloggen/fix_k8s_metrics.yaml new file mode 100755 index 0000000000..20f9e73c0d --- /dev/null +++ b/.chloggen/fix_k8s_metrics.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: breaking + +# 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: Change k8s.replication_controller metrics to k8s.replicationcontroller + +# 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: [1848] + +# (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 c4109cd175..00d1d28f00 100644 --- a/docs/non-normative/k8s-migration.md +++ b/docs/non-normative/k8s-migration.md @@ -129,10 +129,10 @@ The changes in their metric names and types are the following: -| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | -|------------------------------------------------------------------------------------|---------------------------------------------------------------------| -| `k8s.replication_controller.desired` (type: `gauge`) | `k8s.replication_controller.desired_pods` (type: `updowncounter`) | -| `k8s.replication_controller.available` (type: `gauge`) | `k8s.replication_controller.available_pods` (type: `updowncounter`) | +| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | +|------------------------------------------------------------------------------------|--------------------------------------------------------------------| +| `k8s.replication_controller.desired` (type: `gauge`) | `k8s.replicationcontroller.desired_pods` (type: `updowncounter`) | +| `k8s.replication_controller.available` (type: `gauge`) | `k8s.replicationcontroller.available_pods` (type: `updowncounter`) | diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index c38ea67c2c..f84426b928 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -38,8 +38,8 @@ and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`. - [Metric: `k8s.replicaset.desired_pods`](#metric-k8sreplicasetdesired_pods) - [Metric: `k8s.replicaset.available_pods`](#metric-k8sreplicasetavailable_pods) - [ReplicationController Metrics](#replicationcontroller-metrics) - - [Metric: `k8s.replication_controller.desired_pods`](#metric-k8sreplication_controllerdesired_pods) - - [Metric: `k8s.replication_controller.available_pods`](#metric-k8sreplication_controlleravailable_pods) + - [Metric: `k8s.replicationcontroller.desired_pods`](#metric-k8sreplicationcontrollerdesired_pods) + - [Metric: `k8s.replicationcontroller.available_pods`](#metric-k8sreplicationcontrolleravailable_pods) - [StatefulSet Metrics](#statefulset-metrics) - [Metric: `k8s.statefulset.desired_pods`](#metric-k8sstatefulsetdesired_pods) - [Metric: `k8s.statefulset.ready_pods`](#metric-k8sstatefulsetready_pods) @@ -504,13 +504,13 @@ This metric SHOULD, at a minimum, be reported against a ## ReplicationController Metrics -**Description:** ReplicationController level metrics captured under the namespace `k8s.replication_controller`. +**Description:** ReplicationController level metrics captured under the namespace `k8s.replicationcontroller`. -### Metric: `k8s.replication_controller.desired_pods` +### Metric: `k8s.replicationcontroller.desired_pods` This metric is [recommended][MetricRecommended]. - + @@ -519,7 +519,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replication_controller.desired_pods` | UpDownCounter | `{pod}` | Number of desired replica pods in this replication controller [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.replicationcontroller.desired_pods` | UpDownCounter | `{pod}` | Number of desired replica pods in this replication controller [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `replicas` field of the [K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core) @@ -532,11 +532,11 @@ This metric SHOULD, at a minimum, be reported against a -### Metric: `k8s.replication_controller.available_pods` +### Metric: `k8s.replicationcontroller.available_pods` This metric is [recommended][MetricRecommended]. - + @@ -545,7 +545,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replication_controller.available_pods` | UpDownCounter | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.replicationcontroller.available_pods` | UpDownCounter | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `availableReplicas` field of the [K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core) diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index d60e893289..b7938a7f1b 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -183,10 +183,10 @@ groups: instrument: updowncounter unit: "{pod}" - # k8s.replication_controller.* metrics - - id: metric.k8s.replication_controller.desired_pods + # k8s.replicationcontroller.* metrics + - id: metric.k8s.replicationcontroller.desired_pods type: metric - metric_name: k8s.replication_controller.desired_pods + metric_name: k8s.replicationcontroller.desired_pods stability: experimental brief: "Number of desired replica pods in this replication controller" # TODO: Add note for resource correlation once https://github.com/open-telemetry/semantic-conventions/issues/1656 is implemented @@ -198,9 +198,9 @@ groups: [`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource. instrument: updowncounter unit: "{pod}" - - id: metric.k8s.replication_controller.available_pods + - id: metric.k8s.replicationcontroller.available_pods type: metric - metric_name: k8s.replication_controller.available_pods + metric_name: k8s.replicationcontroller.available_pods stability: experimental brief: "Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller" # TODO: Add note for resource correlation once https://github.com/open-telemetry/semantic-conventions/issues/1656 is implemented diff --git a/schema-next.yaml b/schema-next.yaml index fff1f374ef..23675166b0 100644 --- a/schema-next.yaml +++ b/schema-next.yaml @@ -2,6 +2,11 @@ file_format: 1.1.0 schema_url: https://opentelemetry.io/schemas/next versions: next: + metrics: + changes: + - rename_metrics: + k8s.replication_controller.desired_pods: k8s.replicationcontroller.desired_pods + k8s.replication_controller.available_pods: k8s.replicationcontroller.available_pods 1.30.0: all: changes: