Skip to content

Expose cgroup v2 memory.swap.events counters#3890

Open
egorikas wants to merge 1 commit into
google:masterfrom
egorikas:additional-memory-stats-v2
Open

Expose cgroup v2 memory.swap.events counters#3890
egorikas wants to merge 1 commit into
google:masterfrom
egorikas:additional-memory-stats-v2

Conversation

@egorikas

Copy link
Copy Markdown
Contributor

What:
Exposes the three memory.swap.events counters from cgroup v2 as Prometheus metrics:

  • container_memory_swap_events_high_total - times swap usage crossed the memory.swap.high throttle threshold
  • container_memory_swap_events_max_total - times a swap allocation was rejected because memory.swap.max would be exceeded
  • container_memory_swap_events_fail_total - times a swap allocation failed (hit memory.swap.max or the system ran out of swap)

Also backfills the docs for the existing container_memory_events_high_total / container_memory_events_max_total metrics, which were added previously but never documented.

Why:
cAdvisor already publishes memory.events (high/max) and some additional metrics in #3889, but there's no visibility into swap pressure.

When a container is being throttled on swap or having swap allocations denied, the only signal today is indirect (rising swap usage). That's a production-proven implementation.

Extend the cgroup v2 event reporting with the memory.swap.events
counters that aren't yet surfaced by cAdvisor:

- container_memory_swap_events_high_total
- container_memory_swap_events_max_total
- container_memory_swap_events_fail_total

Counters are read key-by-key and tolerate missing keys, so
memory.swap.high (newer kernels) stays at zero where unavailable.

Signed-off-by: egorikas <egorgrishechko@gmail.com>
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.

1 participant