From dbb71afc3fe0962da2236017bb37b0af8f2c6ae7 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Thu, 12 Dec 2024 10:54:51 +0200 Subject: [PATCH] switch types to updowncounter Signed-off-by: ChrsMark --- docs/non-normative/k8s-migration.md | 66 +++++++++++++++++++---------- docs/system/k8s-metrics.md | 28 ++++++------ model/k8s/metrics.yaml | 28 ++++++------ 3 files changed, 72 insertions(+), 50 deletions(-) diff --git a/docs/non-normative/k8s-migration.md b/docs/non-normative/k8s-migration.md index aaf68df43f..6d55cdfdc6 100644 --- a/docs/non-normative/k8s-migration.md +++ b/docs/non-normative/k8s-migration.md @@ -46,6 +46,7 @@ and one for disabling the old schema called `semconv.k8s.disableLegacy`. Then: - [K8s Deployment metrics](#k8s-deployment-metrics) - [K8s ReplicaSet metrics](#k8s-replicaset-metrics) - [K8s ReplicationController metrics](#k8s-replicationcontroller-metrics) + - [K8s StatefulsSet metrics](#k8s-statefulsset-metrics) - [K8s HorizontalPodAutoscaler metrics](#k8s-horizontalpodautoscaler-metrics) @@ -82,14 +83,14 @@ receiver were introduced as semantic conventions in [#1636](https://github.com/open-telemetry/semantic-conventions/pull/1636) (TODO: replace with SemConv version once available). -The changes in their metric names are the following: +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.deployment.desired` | `k8s.deployment.desired_pods` | -| `k8s.deployment.available` | `k8s.deployment.available_pods` | +| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | +|------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `k8s.deployment.desired` (type: `gauge`) | `k8s.deployment.desired_pods` (type: `updowncounter`) | +| `k8s.deployment.available` (type: `gauge`) | `k8s.deployment.available_pods` (type: `updowncounter`) | @@ -101,14 +102,14 @@ receiver were introduced as semantic conventions in [#1636](https://github.com/open-telemetry/semantic-conventions/pull/1636) (TODO: replace with SemConv version once available). -The changes in their metric names are the following: +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.replicaset.desired` | `k8s.replicaset.desired_pods` | -| `k8s.replicaset.available` | `k8s.replicaset.available_pods` | +| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | +|------------------------------------------------------------------------------------|---------------------------------------------------------| +| `k8s.replicaset.desired` (type: `gauge`) | `k8s.replicaset.desired_pods` (type: `updowncounter`) | +| `k8s.replicaset.available` (type: `gauge`) | `k8s.replicaset.available_pods` (type: `updowncounter`) | @@ -120,14 +121,35 @@ receiver were introduced as semantic conventions in [#1636](https://github.com/open-telemetry/semantic-conventions/pull/1636) (TODO: replace with SemConv version once available). -The changes in their metric names are the following: +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` | `k8s.replication_controller.desired_pods` | -| `k8s.replication_controller.available` | `k8s.replication_controller.available_pods` | +| 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`) | + + + +### K8s StatefulsSet metrics + +The K8s StatefulsSet metrics implemented by the Collector and specifically the +[k8scluster](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.115.0/receiver/k8sclusterreceiver/documentation.md) +receiver were introduced as semantic conventions in +[#1636](https://github.com/open-telemetry/semantic-conventions/pull/1636) (TODO: replace with SemConv version once +available). + +The changes in their metric types are the following: + + + +| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | +|------------------------------------------------------------------------------------|----------------------------------------------------------| +| `k8s.statefulset.desired_pods` (type: `gauge`) | `k8s.statefulset.desired_pods` (type: `updowncounter`) | +| `k8s.statefulset.ready_pods` (type: `gauge`) | `k8s.statefulset.ready_pods` (type: `updowncounter`) | +| `k8s.statefulset.current_pods` (type: `gauge`) | `k8s.statefulset.current_pods` (type: `updowncounter`) | +| `k8s.statefulset.updated_pods` (type: `gauge`) | `k8s.statefulset.updated_pods` (type: `updowncounter`) | @@ -139,15 +161,15 @@ receiver were introduced as semantic conventions in [#1636](https://github.com/open-telemetry/semantic-conventions/pull/1636) (TODO: replace with SemConv version once available). -The changes in their metric names are the following: +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.hpa.desired_replicas` | `k8s.hpa.desired_pods` | -| `k8s.hpa.current_replicas` | `k8s.hpa.current_pods` | -| `k8s.hpa.max_replicas` | `k8s.hpa.max_pods` | -| `k8s.hpa.min_replicas` | `k8s.hpa.min_pods` | +| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New | +|------------------------------------------------------------------------------------|------------------------------------------------| +| `k8s.hpa.desired_replicas` (type: `gauge`) | `k8s.hpa.desired_pods` (type: `updowncounter`) | +| `k8s.hpa.current_replicas` (type: `gauge`) | `k8s.hpa.current_pods` (type: `updowncounter`) | +| `k8s.hpa.max_replicas` (type: `gauge`) | `k8s.hpa.max_pods` (type: `updowncounter`) | +| `k8s.hpa.min_replicas` (type: `gauge`) | `k8s.hpa.min_pods` (type: `updowncounter`) | diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index a180edd2b9..d84c73db05 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -394,7 +394,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.deployment.desired_pods` | Gauge | `{pod}` | Number of desired replica pods in this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.deployment.desired_pods` | UpDownCounter | `{pod}` | Number of desired replica pods in this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `replicas` field of the [K8s DeploymentSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps) @@ -417,7 +417,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.deployment.available_pods` | Gauge | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.deployment.available_pods` | UpDownCounter | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `availableReplicas` field of the [K8s DeploymentStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps) @@ -444,7 +444,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replicaset.desired_pods` | Gauge | `{pod}` | Number of desired replica pods in this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.replicaset.desired_pods` | UpDownCounter | `{pod}` | Number of desired replica pods in this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `replicas` field of the [K8s ReplicaSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps) @@ -467,7 +467,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replicaset.available_pods` | Gauge | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.replicaset.available_pods` | UpDownCounter | `{pod}` | Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `availableReplicas` field of the [K8s ReplicaSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps) @@ -494,7 +494,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replication_controller.desired_pods` | Gauge | `{pod}` | Number of desired replica pods in this replication controller [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `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) | **[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) @@ -517,7 +517,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.replication_controller.available_pods` | Gauge | `{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.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) | **[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) @@ -544,7 +544,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.statefulset.desired_pods` | Gauge | `{pod}` | Number of desired replica pods in this statefulset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.statefulset.desired_pods` | UpDownCounter | `{pod}` | Number of desired replica pods in this statefulset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `replicas` field of the [K8s StatefulSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetspec-v1-apps) @@ -567,7 +567,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.statefulset.ready_pods` | Gauge | `{pod}` | The number of replica pods created for this statefulset with a Ready Condition [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.statefulset.ready_pods` | UpDownCounter | `{pod}` | The number of replica pods created for this statefulset with a Ready Condition [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `readyReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) @@ -590,7 +590,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.statefulset.current_pods` | Gauge | `{pod}` | The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.statefulset.current_pods` | UpDownCounter | `{pod}` | The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `currentReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) @@ -613,7 +613,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.statefulset.updated_pods` | Gauge | `{pod}` | Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.statefulset.updated_pods` | UpDownCounter | `{pod}` | Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `updatedReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) @@ -640,7 +640,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.hpa.desired_pods` | Gauge | `{pod}` | Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.hpa.desired_pods` | UpDownCounter | `{pod}` | Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `desiredReplicas` field of the [K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling) @@ -663,7 +663,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.hpa.current_pods` | Gauge | `{pod}` | Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.hpa.current_pods` | UpDownCounter | `{pod}` | Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `currentReplicas` field of the [K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling) @@ -686,7 +686,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.hpa.max_pods` | Gauge | `{pod}` | The upper limit for the number of replica pods to which the autoscaler can scale up [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.hpa.max_pods` | UpDownCounter | `{pod}` | The upper limit for the number of replica pods to which the autoscaler can scale up [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `maxReplicas` field of the [K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling) @@ -709,7 +709,7 @@ This metric is [recommended][MetricRecommended]. | Name | Instrument Type | Unit (UCUM) | Description | Stability | | -------- | --------------- | ----------- | -------------- | --------- | -| `k8s.hpa.min_pods` | Gauge | `{pod}` | The lower limit for the number of replica pods to which the autoscaler can scale down [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.hpa.min_pods` | UpDownCounter | `{pod}` | The lower limit for the number of replica pods to which the autoscaler can scale down [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** This metric aligns with the `minReplicas` field of the [K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling) diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index b621bb1973..c928c9dbaf 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -136,7 +136,7 @@ groups: note: | This metric aligns with the `replicas` field of the [K8s DeploymentSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.deployment.available_pods type: metric @@ -146,7 +146,7 @@ groups: note: | This metric aligns with the `availableReplicas` field of the [K8s DeploymentStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" # k8s.replicaset.* metrics @@ -158,7 +158,7 @@ groups: note: | This metric aligns with the `replicas` field of the [K8s ReplicaSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.replicaset.available_pods type: metric @@ -168,7 +168,7 @@ groups: note: | This metric aligns with the `availableReplicas` field of the [K8s ReplicaSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" # k8s.replication_controller.* metrics @@ -180,7 +180,7 @@ groups: note: | This metric aligns with the `replicas` field of the [K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.replication_controller.available_pods type: metric @@ -190,7 +190,7 @@ groups: note: | This metric aligns with the `availableReplicas` field of the [K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core) - instrument: gauge + instrument: updowncounter unit: "{pod}" # k8s.statefulset.* metrics @@ -202,7 +202,7 @@ groups: note: | This metric aligns with the `replicas` field of the [K8s StatefulSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetspec-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.statefulset.ready_pods type: metric @@ -212,7 +212,7 @@ groups: note: | This metric aligns with the `readyReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.statefulset.current_pods type: metric @@ -222,7 +222,7 @@ groups: note: | This metric aligns with the `currentReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.statefulset.updated_pods type: metric @@ -232,7 +232,7 @@ groups: note: | This metric aligns with the `updatedReplicas` field of the [K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps) - instrument: gauge + instrument: updowncounter unit: "{pod}" # k8s.hpa.* metrics @@ -244,7 +244,7 @@ groups: note: | This metric aligns with the `desiredReplicas` field of the [K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.hpa.current_pods type: metric @@ -254,7 +254,7 @@ groups: note: | This metric aligns with the `currentReplicas` field of the [K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.hpa.max_pods type: metric @@ -264,7 +264,7 @@ groups: note: | This metric aligns with the `maxReplicas` field of the [K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling) - instrument: gauge + instrument: updowncounter unit: "{pod}" - id: metric.k8s.hpa.min_pods type: metric @@ -274,5 +274,5 @@ groups: note: | This metric aligns with the `minReplicas` field of the [K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling) - instrument: gauge + instrument: updowncounter unit: "{pod}"