Skip to content

Commit

Permalink
add more replica related metrics & add _pod suffix
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark committed Dec 4, 2024
1 parent c6736c3 commit f450408
Show file tree
Hide file tree
Showing 3 changed files with 341 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .chloggen/add_deploy_replica_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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, replicaset and replication_controller
note: Add metrics for k8s deployment, replicaset, replication_controller, statefulset and hpa.

# 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.
Expand Down
262 changes: 232 additions & 30 deletions docs/system/k8s-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,24 @@ and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`.
- [Metric: `k8s.node.network.io`](#metric-k8snodenetworkio)
- [Metric: `k8s.node.network.errors`](#metric-k8snodenetworkerrors)
- [Deployment Metrics](#deployment-metrics)
- [Metric: `k8s.deployment.desired`](#metric-k8sdeploymentdesired)
- [Metric: `k8s.deployment.available`](#metric-k8sdeploymentavailable)
- [Metric: `k8s.deployment.desired_pods`](#metric-k8sdeploymentdesired_pods)
- [Metric: `k8s.deployment.available_pods`](#metric-k8sdeploymentavailable_pods)
- [ReplicaSet Metrics](#replicaset-metrics)
- [Metric: `k8s.replicaset.desired`](#metric-k8sreplicasetdesired)
- [Metric: `k8s.replicaset.available`](#metric-k8sreplicasetavailable)
- [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`](#metric-k8sreplication_controllerdesired)
- [Metric: `k8s.replication_controller.available`](#metric-k8sreplication_controlleravailable)
- [Metric: `k8s.replication_controller.desired_pods`](#metric-k8sreplication_controllerdesired_pods)
- [Metric: `k8s.replication_controller.available_pods`](#metric-k8sreplication_controlleravailable_pods)
- [StatefulSet Metrics](#statefulset-metrics)
- [Metric: `k8s.statefulset.desired_pods`](#metric-k8sstatefulsetdesired_pods)
- [Metric: `k8s.statefulset.ready_pods`](#metric-k8sstatefulsetready_pods)
- [Metric: `k8s.statefulset.current_pods`](#metric-k8sstatefulsetcurrent_pods)
- [Metric: `k8s.statefulset.updated_pods`](#metric-k8sstatefulsetupdated_pods)
- [HorizontalPodAutoscaler Metrics](#horizontalpodautoscaler-metrics)
- [Metric: `k8s.hpa.desired_pods`](#metric-k8shpadesired_pods)
- [Metric: `k8s.hpa.current_pods`](#metric-k8shpacurrent_pods)
- [Metric: `k8s.hpa.max_pods`](#metric-k8shpamax_pods)
- [Metric: `k8s.hpa.min_pods`](#metric-k8shpamin_pods)

<!-- tocstop -->

Expand Down Expand Up @@ -371,11 +381,11 @@ This metric is [recommended][MetricRecommended].

**Description:** Deployment level metrics captured under the namespace `k8s.deployment`.

### Metric: `k8s.deployment.desired`
### Metric: `k8s.deployment.desired_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.deployment.desired -->
<!-- semconv metric.k8s.deployment.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -384,21 +394,21 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.deployment.desired` | Gauge | `{pod}` | Number of desired pods in this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `k8s.deployment.desired_pods` | Gauge | `{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 Deployment Spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps)
[K8s DeploymentSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.deployment.available`
### Metric: `k8s.deployment.available_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.deployment.available -->
<!-- semconv metric.k8s.deployment.available_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -407,10 +417,10 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.deployment.available` | Gauge | `{pod}` | Total number of available pods (ready for at least minReadySeconds) targeted by this deployment [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `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) |

**[1]:** This metric aligns with the `availableReplicas` field of the
[K8s Deployment Status](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps)
[K8s DeploymentStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand All @@ -421,11 +431,11 @@ This metric is [recommended][MetricRecommended].

**Description:** ReplicaSet level metrics captured under the namespace `k8s.replicaset`.

### Metric: `k8s.replicaset.desired`
### Metric: `k8s.replicaset.desired_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replicaset.desired -->
<!-- semconv metric.k8s.replicaset.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -434,21 +444,21 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.replicaset.desired` | Gauge | `{pod}` | Number of desired pods in this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `k8s.replicaset.desired_pods` | Gauge | `{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 ReplicaSet Spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps)
[K8s ReplicaSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.replicaset.available`
### Metric: `k8s.replicaset.available_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replicaset.available -->
<!-- semconv metric.k8s.replicaset.available_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -457,10 +467,10 @@ This metric is [recommended][MetricRecommended].

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.replicaset.available` | Gauge | `{pod}` | Total number of available pods (ready for at least minReadySeconds) targeted by this replicaset [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `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) |

**[1]:** This metric aligns with the `availableReplicas` field of the
[K8s ReplicaSet Status](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps)
[K8s ReplicaSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand All @@ -471,11 +481,11 @@ This metric is [recommended][MetricRecommended].

**Description:** ReplicationController level metrics captured under the namespace `k8s.replication_controller`.

### Metric: `k8s.replication_controller.desired`
### Metric: `k8s.replication_controller.desired_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replication_controller.desired -->
<!-- semconv metric.k8s.replication_controller.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -484,21 +494,21 @@ 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) |
| `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) |

**[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)
[K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.replication_controller.available`
### Metric: `k8s.replication_controller.available_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replication_controller.available -->
<!-- semconv metric.k8s.replication_controller.available_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -507,10 +517,202 @@ 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) |
| `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) |

**[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)
[K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## StatefulSet Metrics

**Description:** StatefulSet level metrics captured under the namespace `k8s.statefulset`.

### Metric: `k8s.statefulset.desired_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.statefulset.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.statefulset.ready_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.statefulset.ready_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.statefulset.current_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.statefulset.current_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.statefulset.updated_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.statefulset.updated_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## HorizontalPodAutoscaler Metrics

**Description:** HorizontalPodAutoscaler level metrics captured under the namespace `k8s.hpa`.

### Metric: `k8s.hpa.desired_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.hpa.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.hpa.desired_pods` | Gauge | `{pod}` | Number of replica pods managed by this horizontal pod 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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.hpa.current_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.hpa.current_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| Name | Instrument Type | Unit (UCUM) | Description | Stability |
| -------- | --------------- | ----------- | -------------- | --------- |
| `k8s.hpa.current_pods` | Gauge | `{pod}` | Number of replica pods managed by this horizontal pod 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)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.hpa.max_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.hpa.max_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[1]:** This metric aligns with the `currentReplicas` field of the
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `k8s.hpa.min_pods`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.hpa.min_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |

**[1]:** This metric aligns with the `currentReplicas` field of the
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling)

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
Expand Down
Loading

0 comments on commit f450408

Please sign in to comment.