Skip to content

Commit

Permalink
Make replication controller metrics consistent with resource attributes
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark committed Jan 29, 2025
1 parent b865f63 commit bfa427f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
22 changes: 22 additions & 0 deletions .chloggen/fix_k8s_metrics.yaml
Original file line number Diff line number Diff line change
@@ -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:
8 changes: 4 additions & 4 deletions docs/non-normative/k8s-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ 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`) |
| 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`) |

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

Expand Down
18 changes: 9 additions & 9 deletions docs/system/k8s-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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].

<!-- semconv metric.k8s.replication_controller.desired_pods -->
<!-- semconv metric.k8s.replicationcontroller.desired_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -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)
Expand All @@ -532,11 +532,11 @@ This metric SHOULD, at a minimum, be reported against a
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

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

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replication_controller.available_pods -->
<!-- semconv metric.k8s.replicationcontroller.available_pods -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions model/k8s/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions schema-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bfa427f

Please sign in to comment.