Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .chloggen/add_k8s_memory_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 memory metrics for k8s.node, k8s.pod and container resources

# 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: [2776]

# (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:
57 changes: 57 additions & 0 deletions docs/non-normative/k8s-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ and one for disabling the old schema called `semconv.k8s.disableLegacy`. Then:
- [K8s Node condition metrics](#k8s-node-condition-metrics)
- [K8s Filesystem metrics](#k8s-filesystem-metrics)
- [K8s Pod Volume metrics](#k8s-pod-volume-metrics)
- [K8s Pod Memory metrics](#k8s-pod-memory-metrics)
- [Container memory metrics](#container-memory-metrics)
- [K8s Node memory metrics](#k8s-node-memory-metrics)
- [Container Runtime](#container-runtime)

<!-- tocstop -->
Expand Down Expand Up @@ -422,6 +425,60 @@ The changes in these metrics are the following:

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

### K8s Pod Memory metrics

The K8s Pod memory metrics implemented by the Collector and specifically the
[k8scluster](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.119.0/receiver/k8sclusterreceiver/documentation.md)
receiver were introduced as semantic conventions in
[#1490](https://github.com/open-telemetry/semantic-conventions/issues/1490).

The changes in these metrics are the following:

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

| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
|------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `k8s.pod.memory.page_faults` | `k8s.pod.memory.paging.faults` with attribute `system.paging.type` set to `minor` |
| `k8s.pod.memory.major_page_faults` | `k8s.pod.memory.paging.faults` with attribute `system.paging.type` set to `major` |

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

### Container memory metrics

The Container memory metrics implemented by the Collector and specifically the
[k8scluster](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.119.0/receiver/k8sclusterreceiver/documentation.md)
receiver were introduced as semantic conventions in
[#1490](https://github.com/open-telemetry/semantic-conventions/issues/1490).

The changes in these metrics are the following:

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

| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| `container.memory.page_faults` | `container.memory.paging.faults` with attribute `system.paging.type` set to `minor` |
| `container.memory.major_page_faults` | `container.memory.paging.faults` with attribute `system.paging.type` set to `major` |

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

### K8s Node memory metrics

The K8s Node memory metrics implemented by the Collector and specifically the
[k8scluster](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.119.0/receiver/k8sclusterreceiver/documentation.md)
receiver were introduced as semantic conventions in
[#1490](https://github.com/open-telemetry/semantic-conventions/issues/1490).

The changes in these metrics are the following:

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

| Old (Collector) ![changed](https://img.shields.io/badge/changed-orange?style=flat) | New |
|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| `k8s.node.memory.page_faults` | `k8s.node.memory.paging.faults` with attribute `system.paging.type` set to `minor` |
| `k8s.node.memory.major_page_faults` | `k8s.node.memory.paging.faults` with attribute `system.paging.type` set to `major` |

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

### Container Runtime

The container runtime has become more descriptive with changes introduced to semantic conventions
Expand Down
110 changes: 110 additions & 0 deletions docs/system/container-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ well-defined APIs (e.g. Kubelet's API or container runtimes).
- [Metric: `container.cpu.time`](#metric-containercputime)
- [Metric: `container.cpu.usage`](#metric-containercpuusage)
- [Metric: `container.memory.usage`](#metric-containermemoryusage)
- [Metric: `container.memory.available`](#metric-containermemoryavailable)
- [Metric: `container.memory.rss`](#metric-containermemoryrss)
- [Metric: `container.memory.working_set`](#metric-containermemoryworking_set)
- [Metric: `container.memory.paging.faults`](#metric-containermemorypagingfaults)
- [Metric: `container.disk.io`](#metric-containerdiskio)
- [Metric: `container.network.io`](#metric-containernetworkio)
- [Metric: `container.filesystem.available`](#metric-containerfilesystemavailable)
Expand Down Expand Up @@ -161,6 +165,112 @@ This metric is [opt-in][MetricOptIn].
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `container.memory.available`

This metric is [opt-in][MetricOptIn].

<!-- semconv metric.container.memory.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 | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `container.memory.available` | UpDownCounter | `By` | Container memory available. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`container`](/docs/registry/entities/container.md#container) |

**[1]:** Available memory for use. This is defined as the memory limit - workingSetBytes. If memory limit is undefined, the available bytes is omitted.
In general, this metric can be derived from [cadvisor](https://github.com/google/cadvisor/blob/v0.53.0/docs/storage/prometheus.md#prometheus-container-metrics) and by subtracting the `container_memory_working_set_bytes` metric from the `container_spec_memory_limit_bytes` metric.
In K8s, this metric is derived from the [MemoryStats.AvailableBytes](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats) field of the [PodStats.Memory](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats) of the Kubelet's stats API.

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

### Metric: `container.memory.rss`

This metric is [opt-in][MetricOptIn].

<!-- semconv metric.container.memory.rss -->
<!-- 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 | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `container.memory.rss` | UpDownCounter | `By` | Container memory RSS. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`container`](/docs/registry/entities/container.md#container) |

**[1]:** In general, this metric can be derived from [cadvisor](https://github.com/google/cadvisor/blob/v0.53.0/docs/storage/prometheus.md#prometheus-container-metrics) and specifically the `container_memory_rss` metric.
In K8s, this metric is derived from the [MemoryStats.RSSBytes](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats) field of the [PodStats.Memory](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats) of the Kubelet's stats API.

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

### Metric: `container.memory.working_set`

This metric is [opt-in][MetricOptIn].

<!-- semconv metric.container.memory.working_set -->
<!-- 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 | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `container.memory.working_set` | UpDownCounter | `By` | Container memory working set. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`container`](/docs/registry/entities/container.md#container) |

**[1]:** In general, this metric can be derived from [cadvisor](https://github.com/google/cadvisor/blob/v0.53.0/docs/storage/prometheus.md#prometheus-container-metrics) and specifically the `container_memory_working_set_bytes` metric.
In K8s, this metric is derived from the [MemoryStats.WorkingSetBytes](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats) field of the [PodStats.Memory](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats) of the Kubelet's stats API.

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

### Metric: `container.memory.paging.faults`

This metric is [opt-in][MetricOptIn].

<!-- semconv metric.container.memory.paging.faults -->
<!-- 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 | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `container.memory.paging.faults` | Counter | `{fault}` | Container memory paging faults. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`container`](/docs/registry/entities/container.md#container) |

**[1]:** In general, this metric can be derived from [cadvisor](https://github.com/google/cadvisor/blob/v0.53.0/docs/storage/prometheus.md#prometheus-container-metrics) and specifically the `container_memory_failures_total{failure_type=pgfault, scope=container}` and `container_memory_failures_total{failure_type=pgmajfault, scope=container}`metric.
In K8s, this metric is derived from the [MemoryStats.PageFaults](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats) and [MemoryStats.MajorPageFaults](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#MemoryStats) field of the [PodStats.Memory](https://pkg.go.dev/k8s.io/[email protected]/pkg/apis/stats/v1alpha1#PodStats) of the Kubelet's stats API.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`system.paging.type`](/docs/registry/attributes/system.md) | string | The memory paging type | `minor` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |

---

`system.paging.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `major` | major | ![Development](https://img.shields.io/badge/-development-blue) |
| `minor` | minor | ![Development](https://img.shields.io/badge/-development-blue) |

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

### Metric: `container.disk.io`

This metric is [opt-in][MetricOptIn].
Expand Down
Loading
Loading