From 34c7391195eb7a70e91c72a277bcaab540028240 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Tue, 3 Dec 2024 16:49:27 +0200 Subject: [PATCH] add replication_controller metrics Signed-off-by: ChrsMark --- .chloggen/add_deploy_replica_metrics.yaml | 2 +- docs/system/k8s-metrics.md | 53 +++++++++++++++++++++++ model/k8s/metrics.yaml | 22 ++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/.chloggen/add_deploy_replica_metrics.yaml b/.chloggen/add_deploy_replica_metrics.yaml index 568b2e2ac7..da8cb10914 100755 --- a/.chloggen/add_deploy_replica_metrics.yaml +++ b/.chloggen/add_deploy_replica_metrics.yaml @@ -10,7 +10,7 @@ change_type: enhancement component: k8s # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add desired and available metrics for k8s deployment and replicaset +note: Add desired and available metrics for k8s deployment, replicaset and replication_controller # 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. diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index 3f33085a29..92e2c5dbf5 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -39,6 +39,9 @@ and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`. - [ReplicaSet Metrics](#replicaset-metrics) - [Metric: `k8s.replicaset.desired`](#metric-k8sreplicasetdesired) - [Metric: `k8s.replicaset.available`](#metric-k8sreplicasetavailable) +- [ReplicationController Metrics](#replicationcontroller-metrics) + - [Metric: `k8s.replication_controller.desired`](#metric-k8sreplication_controllerdesired) + - [Metric: `k8s.replication_controller.available`](#metric-k8sreplication_controlleravailable) @@ -464,5 +467,55 @@ This metric is [recommended][MetricRecommended]. +## ReplicationController Metrics + +**Description:** ReplicationController level metrics captured under the namespace `k8s.replication_controller`. + +### Metric: `k8s.replication_controller.desired` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.replication_controller.desired` | Gauge | `{pod}` | Number of desired 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 ReplicationController Spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core) + + + + + + +### Metric: `k8s.replication_controller.available` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.replication_controller.available` | Gauge | `{pod}` | Total number of available 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 ReplicationController Status](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core) + + + + + + [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status [MetricRecommended]: /docs/general/metric-requirement-level.md#recommended diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index 6c8ccd162c..94060976f6 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -170,3 +170,25 @@ groups: [K8s ReplicaSet Status](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps) instrument: gauge unit: "{pod}" + + # k8s.replication_controller.* metrics + - id: metric.k8s.replication_controller.desired + type: metric + metric_name: k8s.replication_controller.desired + stability: experimental + brief: "Number of desired pods in this replication controller" + note: | + This metric aligns with the `replicas` field of the + [K8s ReplicationController Spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core) + instrument: gauge + unit: "{pod}" + - id: metric.k8s.replication_controller.available + type: metric + metric_name: k8s.replication_controller.available + stability: experimental + brief: "Total number of available pods (ready for at least minReadySeconds) targeted by this replication controller" + note: | + This metric aligns with the `availableReplicas` field of the + [K8s ReplicationController Status](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core) + instrument: gauge + unit: "{pod}"