fix: make OOM kill count cumulative in container metrics timeseries#377
Open
debot-macmini1 wants to merge 1 commit into
Open
fix: make OOM kill count cumulative in container metrics timeseries#377debot-macmini1 wants to merge 1 commit into
debot-macmini1 wants to merge 1 commit into
Conversation
|
Important Your team uses Gitar, but you don't have an assigned seat yet. Ask a team admin to add your seat so Gitar can review your code. Learn more |
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.
Problem
OOM events are visible via the new
container_oom_eventresource path, but the "normal" container metrics timeseries (MPA streamContainerMetricItem) does not reliably reflect OOMs.Root cause in current implementation:
SubscriptionManager.Broadcastsetsoom_kill_countto 0/1 based only on the current sample'sLastTerminationReason.oom_kill_countto be cumulative if available.Fix
Make
oom_kill_counta cumulative, sticky count per(namespace/pod/container)insideSubscriptionManager:{count, lastRestart}in-memory.LastTerminationReason == OOMKilledANDRestartCountadvances beyond the last processed restartCount.oom_kill_counton every subsequent utilization sample.This means even if the OOM-bearing sample is dropped due to backpressure, the counter persists and later samples still reflect the OOM.
Tests (negative/robustness)
Added unit tests in
internal/server/mpa_server_test.go:oom_kill_countis cumulative and sticky across non-OOM samples.oom_kill_count=1.Notes
go test ./...runs e2e (test/e2e) which can hang locally; unit tests can be run with:go test ./internal/server -run TestSubscriptionManager -count=1