Expose cgroup v2 memory.swap.events counters#3890
Open
egorikas wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thresholdcontainer_memory_swap_events_max_total- times a swap allocation was rejected because memory.swap.max would be exceededcontainer_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_totalmetrics, which were added previously but never documented.Why:
cAdvisoralready publishesmemory.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.