Repository navigation
Expose bounded runtime resource observations for recovery - #372
Merged
Merged
Conversation
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.
Recovery health checks currently run Kubernetes exec on every worker/master to read container memory and OOM state. Expose a bounded read-only
/api/v1/internal/runtime-resourcesendpoint through their existing shared router so managed recovery can obtain the same evidence directly.Each request reads the three cgroup-v2 memory files, with an 8 KiB limit per file, and returns usage, nullable limit, raw OOM counters, sample time and an optional caller nonce. Responses are not cached; missing/malformed/unsupported cgroups return 503 rather than stale data or invented zero values. It does not access stores or alter writer ownership. Callers must still validate Pod/container identity, readiness, expected configuration, freshness and their existing admission thresholds.
Validation:
cargo test -p lance-context-metrics --locked(4 tests passed) andcargo clippy -p lance-context-metrics --all-targets --locked -- -D warningspass. Tests cover fresh changes, failed reads after previous success, unlimited budgets, retained OOM evidence, malformed/oversized files, and shared-router wiring. Only the existing serde_json dependency is added to this crate's lock entry.