Skip to content

Commit

Permalink
Add metrics for deployment, replicaset, replication_controller, state…
Browse files Browse the repository at this point in the history
…fulset and hpa (#1636)

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Co-authored-by: Tetiana Kravchenko <tanya.kravchenko.v@gmail.com>
  • Loading branch information
ChrsMark and tetianakravchenko authored Dec 17, 2024
1 parent 3be2bcb commit b60cdba
Show file tree
Hide file tree
Showing 4 changed files with 731 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .chloggen/add_deploy_replica_metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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 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.
issues: [1636, 1637, 1644]

# (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: |
This addition focused on providing consistency between these metrics, while
also ensuring alignment with recommendations from Kubernetes.
More details in https://github.com/open-telemetry/semantic-conventions/issues/1637
117 changes: 112 additions & 5 deletions docs/non-normative/k8s-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ and one for disabling the old schema called `semconv.k8s.disableLegacy`. Then:

- [Summary of changes](#summary-of-changes)
- [K8s network metrics](#k8s-network-metrics)
- [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)

<!-- tocstop -->

Expand All @@ -56,13 +61,115 @@ to bring the conventions to stable (TODO: link to specific version once it exist

The K8s network metrics implemented by the Collector and specifically the
[kubeletstats](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.112.0/receiver/kubeletstatsreceiver/documentation.md)
receiver were introduced as semantic conventions in [v1.29.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/system/k8s-metrics.md).
receiver were introduced as semantic conventions
in [v1.29.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/system/k8s-metrics.md).

The changes in their attributes are the following:

<!-- prettier-ignore-start -->
| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
|------------------------------------------------------------------------------------|---------------------------|
| `interface` | `network.interface.name` |
| `direction` | `network.io.direction` |

| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
|------------------------------------------------------------------------------------|--------------------------|
| `interface` | `network.interface.name` |
| `direction` | `network.io.direction` |

<!-- prettier-ignore-end -->

### K8s Deployment metrics

The K8s Deployment 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 names and types are the following:

<!-- prettier-ignore-start -->

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

<!-- prettier-ignore-end -->

### K8s ReplicaSet metrics

The K8s ReplicaSet 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 names and types are the following:

<!-- prettier-ignore-start -->

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

<!-- prettier-ignore-end -->

### K8s ReplicationController metrics

The K8s ReplicationController 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 names and types are the following:

<!-- prettier-ignore-start -->

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

<!-- prettier-ignore-end -->

### 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:

<!-- prettier-ignore-start -->

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

<!-- prettier-ignore-end -->

### K8s HorizontalPodAutoscaler metrics

The K8s HorizontalPodAutoscaler 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 names and types are the following:

<!-- prettier-ignore-start -->

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

<!-- prettier-ignore-end -->
Loading

0 comments on commit b60cdba

Please sign in to comment.