Skip to content

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

Merged
lmolkova merged 6 commits intoopen-telemetry:mainfrom
rogercoll:clarify_used_memory
Aug 7, 2025
Merged

Used memory should be based on operating system's internals#2534
lmolkova merged 6 commits intoopen-telemetry:mainfrom
rogercoll:clarify_used_memory

Conversation

@rogercoll
Copy link
Copy Markdown
Contributor

Changes

This PR clarifies the expected value of the used memory attribute on Linux systems, specifying that it should be derived from MemAvailable for a more accurate representation of memory usage.

On Linux, using MemAvailable breaks the assumption that the sum of all system.memory.state values equals system.memory.limit. However, this assumption is only valid because the current used value is derived indirectly from the limit and other memory states (total - free - buffers - cached), which can misrepresent actual memory pressure (with some issues). If the current used state is derivable, I recommend redefining it to reflect a more meaningful value that cannot be derived—specifically one based on MemAvailable—and making system.memory.limit enabled by default.

While the proposed used value can still be calculated from the optional system.memory.limit and system.linux.memory.available metrics, doing so requires awareness of the current used state’s inaccuracy and explicit user configuration. This change aims to promote a more accurate and meaningful metric for memory usage in Linux environments.

Context: shirou/gopsutil#1873
Repository to test the different formulas: https://github.com/rogercoll/linux-memory-metrics

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

@github-actions github-actions Bot added enhancement New feature or request area:system labels Jul 17, 2025
@rogercoll rogercoll marked this pull request as ready for review July 17, 2025 10:41
@rogercoll rogercoll requested review from a team as code owners July 17, 2025 10:41
Comment thread model/system/registry.yaml Outdated
@rogercoll
Copy link
Copy Markdown
Contributor Author

Opened this issue to work on the fix for breaking the aggregation over the states: #2538

cc @open-telemetry/semconv-system-approvers @dmitryax

Comment thread model/system/registry.yaml Outdated
@lmolkova lmolkova moved this to Awaiting codeowners approval in Semantic Conventions Triage Jul 31, 2025
@lmolkova lmolkova moved this from Awaiting codeowners approval to Ready to be Merged in Semantic Conventions Triage Jul 31, 2025
@lmolkova lmolkova moved this from Ready to be Merged to Awaiting codeowners approval in Semantic Conventions Triage Jul 31, 2025
@github-project-automation github-project-automation Bot moved this from Awaiting codeowners approval to Needs More Approval in Semantic Conventions Triage Aug 7, 2025
@lmolkova lmolkova added this pull request to the merge queue Aug 7, 2025
Merged via the queue into open-telemetry:main with commit 37eb9d4 Aug 7, 2025
15 checks passed
@rogercoll rogercoll deleted the clarify_used_memory branch August 8, 2025 07:08
joaopgrassi pushed a commit to dynatrace-oss-contrib/semantic-conventions that referenced this pull request Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:system enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants