Skip to content

feat: add cgroup v2 memory metrics - #1233

Open
terrywilcox wants to merge 3 commits into
mainfrom
feat/pooler-822-cgroup-memory-metrics
Open

terrywilcox wants to merge 3 commits into
mainfrom
feat/pooler-822-cgroup-memory-metrics

Conversation

@terrywilcox

@terrywilcox terrywilcox commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

add a metric for memory.current/memory.max from the process's own cgroup v2 directory as supavisor_prom_ex_osmon_cgroup_memory_{current,max}

Cgroup memory measures actual OS-level RSS for the whole process (everything the kernel charges to it — BEAM heaps, NIF/native allocations, allocator overhead), while :erlang.memory() only reports what BEAM's own allocator tracks internally, so it misses anything outside erts_alloc's bookkeeping.

Comment thread lib/supavisor/monitoring/cgroup.ex Fixed
- skip sobelow Traversal.FileModule on read_max/1's File.read, same
  as the other internally-derived paths in this file
- add a test exercising the cached branch of cached_cgroup_dir/0,
  the one line that wasn't covered by any existing test
@terrywilcox
terrywilcox marked this pull request as ready for review October 6, 2026 14:26
@terrywilcox
terrywilcox requested a review from a team as a code owner October 6, 2026 14:26
The :linux-tagged tests depend on the CI runner's real cgroup setup,
which doesn't reliably exercise the full real-file success path (only
the /proc/self/cgroup path-resolution half of it). Seed the
persistent_term cache directly with a fixture directory so the
production zero-arg entrypoint is covered on any platform.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants