Used memory should be based on operating system's internals (#2534)

This commit is contained in:
Roger Coll 2025-08-07 18:34:53 +02:00 committed by GitHub
parent c797019120
commit 37eb9d427a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 16 deletions

View File

@ -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: system
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Used memory should be based on operating system's internals
# 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: [2534]
# (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:

View File

@ -69,7 +69,9 @@ Describes System Memory attributes
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
**[1]:** Calculation based on the operating system metrics. On Linux, this corresponds to "MemTotal - MemAvailable" from /proc/meminfo, which more accurately reflects memory in active use by applications compared to older formulas based on free, cached, and buffers. If MemAvailable is not available, a fallback to those older formulas may be used.
## System Paging Attributes

View File

@ -272,10 +272,7 @@ This metric is [recommended][MetricRecommended].
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `system.memory.usage` | UpDownCounter | `By` | Reports memory in use by state. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
**[1]:** The sum over all `system.memory.state` values SHOULD equal the total memory
available on the system, that is `system.memory.limit`.
| `system.memory.usage` | UpDownCounter | `By` | Reports memory in use by state. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
@ -290,7 +287,9 @@ available on the system, that is `system.memory.limit`.
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
**[1]:** Calculation based on the operating system metrics. On Linux, this corresponds to "MemTotal - MemAvailable" from /proc/meminfo, which more accurately reflects memory in active use by applications compared to older formulas based on free, cached, and buffers. If MemAvailable is not available, a fallback to those older formulas may be used.
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
@ -310,9 +309,7 @@ This metric is [opt-in][MetricOptIn].
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `system.memory.limit` | UpDownCounter | `By` | Total memory available in the system. [1] | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
**[1]:** Its value SHOULD equal the sum of `system.memory.state` over all states.
| `system.memory.limit` | UpDownCounter | `By` | Total virtual memory available in the system. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
@ -370,7 +367,9 @@ This metric is [recommended][MetricRecommended].
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
**[1]:** Calculation based on the operating system metrics. On Linux, this corresponds to "MemTotal - MemAvailable" from /proc/meminfo, which more accurately reflects memory in active use by applications compared to older formulas based on free, cached, and buffers. If MemAvailable is not available, a fallback to those older formulas may be used.
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

View File

@ -105,9 +105,6 @@ groups:
metric_value_type: int
stability: development
brief: "Reports memory in use by state."
note: |
The sum over all `system.memory.state` values SHOULD equal the total memory
available on the system, that is `system.memory.limit`.
instrument: updowncounter
unit: "By"
attributes:
@ -122,9 +119,7 @@ groups:
code_generation:
metric_value_type: int
stability: development
brief: "Total memory available in the system."
note: |
Its value SHOULD equal the sum of `system.memory.state` over all states.
brief: "Total virtual memory available in the system."
instrument: updowncounter
unit: "By"
attributes: []

View File

@ -22,6 +22,13 @@ groups:
- id: used
value: 'used'
stability: development
brief: Actual used virtual memory in bytes.
note: >
Calculation based on the operating system metrics.
On Linux, this corresponds to "MemTotal - MemAvailable" from /proc/meminfo, which
more accurately reflects memory in active use by applications compared to older
formulas based on free, cached, and buffers. If MemAvailable is not available,
a fallback to those older formulas may be used.
- id: free
value: 'free'
stability: development