Skip to content

Expose bounded runtime resource observations for recovery - #372

Merged
beinan merged 1 commit into
mainfrom
codex/recovery-runtime-health
Oct 18, 2026
Merged

beinan merged 1 commit into
mainfrom
codex/recovery-runtime-health

Conversation

@beinan

@beinan beinan commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

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-resources endpoint 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) and cargo clippy -p lance-context-metrics --all-targets --locked -- -D warnings pass. 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.

@beinan
beinan merged commit c5b5bb5 into main Oct 18, 2026
16 checks passed
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