Skip to content

Commit

Permalink
add desired and available metrics for deployment and replicaset
Browse files Browse the repository at this point in the history
Signed-off-by: ChrsMark <[email protected]>
  • Loading branch information
ChrsMark committed Nov 29, 2024
1 parent 0edb9e2 commit be17329
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .chloggen/add_deploy_replica_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: 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 desired and available metrics for k8s deployment and replicaset

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

# (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:
123 changes: 123 additions & 0 deletions docs/system/k8s-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@ well-defined APIs (e.g. Kubelet's API).
Metrics in `k8s.` instruments SHOULD be attached to a [K8s Resource](/docs/resource/k8s.md)
and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`.

<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` -->

<!-- toc -->

- [Pod Metrics](#pod-metrics)
- [Metric: `k8s.pod.uptime`](#metric-k8spoduptime)
- [Metric: `k8s.pod.cpu.time`](#metric-k8spodcputime)
- [Metric: `k8s.pod.cpu.usage`](#metric-k8spodcpuusage)
- [Metric: `k8s.pod.memory.usage`](#metric-k8spodmemoryusage)
- [Metric: `k8s.pod.network.io`](#metric-k8spodnetworkio)
- [Metric: `k8s.pod.network.errors`](#metric-k8spodnetworkerrors)
- [Node Metrics](#node-metrics)
- [Metric: `k8s.node.uptime`](#metric-k8snodeuptime)
- [Metric: `k8s.node.cpu.time`](#metric-k8snodecputime)
- [Metric: `k8s.node.cpu.usage`](#metric-k8snodecpuusage)
- [Metric: `k8s.node.memory.usage`](#metric-k8snodememoryusage)
- [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)
- [ReplicaSet Metrics](#replicaset-metrics)
- [Metric: `k8s.replicaset.desired`](#metric-k8sreplicasetdesired)
- [Metric: `k8s.replicaset.available`](#metric-k8sreplicasetavailable)

<!-- tocstop -->

## Pod Metrics

**Description:** Pod level metrics captured under the namespace `k8s.pod`.

### Metric: `k8s.pod.uptime`

This metric is [recommended][MetricRecommended].
Expand Down Expand Up @@ -172,6 +203,10 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Node Metrics

**Description:** Node level metrics captured under the namespace `k8s.node`.

### Metric: `k8s.node.uptime`

This metric is [recommended][MetricRecommended].
Expand Down Expand Up @@ -329,5 +364,93 @@ This metric is [recommended][MetricRecommended].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Deployment Metrics

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

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

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.deployment.desired -->
<!-- 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.deployment.desired` | Gauge | `{pod}` | Number of desired pods in this deployment | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

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

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

This metric is [recommended][MetricRecommended].

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

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

## ReplicaSet Metrics

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

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

This metric is [recommended][MetricRecommended].

<!-- semconv metric.k8s.replicaset.desired -->
<!-- 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.replicaset.desired` | Gauge | `{pod}` | Number of desired pods in this replicaset | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

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

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

This metric is [recommended][MetricRecommended].

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

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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
[MetricRecommended]: /docs/general/metric-requirement-level.md#recommended
32 changes: 32 additions & 0 deletions model/k8s/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,35 @@ groups:
attributes:
- ref: network.interface.name
- ref: network.io.direction

# k8s.deployment.* metrics
- id: metric.k8s.deployment.desired
type: metric
metric_name: k8s.deployment.desired
stability: experimental
brief: "Number of desired pods in this deployment"
instrument: gauge
unit: "{pod}"
- id: metric.k8s.deployment.available
type: metric
metric_name: k8s.deployment.available
stability: experimental
brief: "Total number of available pods (ready for at least minReadySeconds) targeted by this deployment"
instrument: gauge
unit: "{pod}"

# k8s.replicaset.* metrics
- id: metric.k8s.replicaset.desired
type: metric
metric_name: k8s.replicaset.desired
stability: experimental
brief: "Number of desired pods in this replicaset"
instrument: gauge
unit: "{pod}"
- id: metric.k8s.replicaset.available
type: metric
metric_name: k8s.replicaset.available
stability: experimental
brief: "Total number of available pods (ready for at least minReadySeconds) targeted by this replicaset"
instrument: gauge
unit: "{pod}"

0 comments on commit be17329

Please sign in to comment.