Skip to content

Commit 37eb9d4

Browse files
authored
Used memory should be based on operating system's internals (#2534)
1 parent c797019 commit 37eb9d4

File tree

5 files changed

+41
-16
lines changed

5 files changed

+41
-16
lines changed

.chloggen/clarify_used_memory.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: enhancement
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: system
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Used memory should be based on operating system's internals
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [2534]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/registry/attributes/system.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ Describes System Memory attributes
6969
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
7070
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
7171
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
72-
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
72+
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
73+
74+
**[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.
7375

7476
## System Paging Attributes
7577

docs/system/system-metrics.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,7 @@ This metric is [recommended][MetricRecommended].
272272

273273
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
274274
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
275-
| `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) |
276-
277-
**[1]:** The sum over all `system.memory.state` values SHOULD equal the total memory
278-
available on the system, that is `system.memory.limit`.
275+
| `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) |
279276

280277
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
281278
|---|---|---|---|---|---|
@@ -290,7 +287,9 @@ available on the system, that is `system.memory.limit`.
290287
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
291288
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
292289
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
293-
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
290+
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
291+
292+
**[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.
294293

295294
<!-- markdownlint-restore -->
296295
<!-- prettier-ignore-end -->
@@ -310,9 +309,7 @@ This metric is [opt-in][MetricOptIn].
310309

311310
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
312311
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
313-
| `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) |
314-
315-
**[1]:** Its value SHOULD equal the sum of `system.memory.state` over all states.
312+
| `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) |
316313

317314
<!-- markdownlint-restore -->
318315
<!-- prettier-ignore-end -->
@@ -370,7 +367,9 @@ This metric is [recommended][MetricRecommended].
370367
| `buffers` | buffers | ![Development](https://img.shields.io/badge/-development-blue) |
371368
| `cached` | cached | ![Development](https://img.shields.io/badge/-development-blue) |
372369
| `free` | free | ![Development](https://img.shields.io/badge/-development-blue) |
373-
| `used` | used | ![Development](https://img.shields.io/badge/-development-blue) |
370+
| `used` | Actual used virtual memory in bytes. [1] | ![Development](https://img.shields.io/badge/-development-blue) |
371+
372+
**[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.
374373

375374
<!-- markdownlint-restore -->
376375
<!-- prettier-ignore-end -->

model/system/metrics.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ groups:
105105
metric_value_type: int
106106
stability: development
107107
brief: "Reports memory in use by state."
108-
note: |
109-
The sum over all `system.memory.state` values SHOULD equal the total memory
110-
available on the system, that is `system.memory.limit`.
111108
instrument: updowncounter
112109
unit: "By"
113110
attributes:
@@ -122,9 +119,7 @@ groups:
122119
code_generation:
123120
metric_value_type: int
124121
stability: development
125-
brief: "Total memory available in the system."
126-
note: |
127-
Its value SHOULD equal the sum of `system.memory.state` over all states.
122+
brief: "Total virtual memory available in the system."
128123
instrument: updowncounter
129124
unit: "By"
130125
attributes: []

model/system/registry.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ groups:
2222
- id: used
2323
value: 'used'
2424
stability: development
25+
brief: Actual used virtual memory in bytes.
26+
note: >
27+
Calculation based on the operating system metrics.
28+
On Linux, this corresponds to "MemTotal - MemAvailable" from /proc/meminfo, which
29+
more accurately reflects memory in active use by applications compared to older
30+
formulas based on free, cached, and buffers. If MemAvailable is not available,
31+
a fallback to those older formulas may be used.
2532
- id: free
2633
value: 'free'
2734
stability: development

0 commit comments

Comments
 (0)