diff --git a/.chloggen/add_deploy_replica_metrics.yaml b/.chloggen/add_deploy_replica_metrics.yaml new file mode 100755 index 0000000000..568b2e2ac7 --- /dev/null +++ b/.chloggen/add_deploy_replica_metrics.yaml @@ -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: diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index 9187ddf2db..54b5434335 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -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`. + + + + +- [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) + + + +## Pod Metrics + +**Description:** Pod level metrics captured under the namespace `k8s.pod`. + ### Metric: `k8s.pod.uptime` This metric is [recommended][MetricRecommended]. @@ -172,6 +203,10 @@ This metric is [recommended][MetricRecommended]. +## Node Metrics + +**Description:** Node level metrics captured under the namespace `k8s.node`. + ### Metric: `k8s.node.uptime` This metric is [recommended][MetricRecommended]. @@ -329,5 +364,93 @@ This metric is [recommended][MetricRecommended]. +## Deployment Metrics + +**Description:** Deployment level metrics captured under the namespace `k8s.deployment`. + +### Metric: `k8s.deployment.desired` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| 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) | + + + + + + +### Metric: `k8s.deployment.available` + +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 | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + + + + + +## ReplicaSet Metrics + +**Description:** ReplicaSet level metrics captured under the namespace `k8s.replicaset`. + +### Metric: `k8s.replicaset.desired` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| 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) | + + + + + + +### Metric: `k8s.replicaset.available` + +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 | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + + + + + [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status [MetricRecommended]: /docs/general/metric-requirement-level.md#recommended diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index 7afd7ec20d..37e46f7d36 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -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}"