Skip to content

feat(resources): expose authenticated kernel pressure snapshots - #4896

Closed
tang-vu wants to merge 1 commit into
Osmantic:public-betafrom
tang-vu:feat/beta-resource-pressure-api-20260914
Closed

tang-vu wants to merge 1 commit into
Osmantic:public-betafrom
tang-vu:feat/beta-resource-pressure-api-20260914

Conversation

@tang-vu

@tang-vu tang-vu commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Why this matters

Model loading, indexing and inference can stall even when CPU utilization looks low. Add authenticated GET /api/resources/pressure so operators and monitoring workflows can inspect CPU, memory and I/O stall time through ODS's existing API access path. A live WSL probe during this batch showed substantial I/O pressure, providing a concrete diagnostic use case beyond synthetic fixtures.

The producer is the kernel's /proc/pressure/{cpu,memory,io} interface. Three small reads run on a worker thread; the response includes capture time, percent/microsecond units in field names, and the explicit api-runtime-kernel scope. Nothing is persisted or mutated. There is no polling service, Docker socket, host-agent lifecycle change, or automatic workload policy.

The preserved invariant is that missing data is never reported as zero pressure. Missing files and permission denial remain distinct per-resource unavailable states; malformed data returns 502. CPU full pressure is null because the kernel contract defines it as undefined at system scope. VM/WSL observations are not promoted to physical-host or per-container attribution.

Overlap check

Searched all open/closed upstream PRs for pressure-stall/PSI, /proc/pressure, the proposed endpoint, resource_pressure.py, and changed routers/resources.py. #3852 adds filtered container/disk snapshots; #2579/#2779 validate host-agent container stats; #2007/#2041/#2078/#2857 handle existing resource data. None exposes kernel stall measurements. This endpoint does not alter their routes, cache keys, disk scans, restartability or stats aggregation.

Validation

  • New endpoint regressions fail on the base (404) before implementation.
  • ODS_TEST_LIVE_PSI=1 .../pytest -q tests/test_resource_pressure.py tests/test_resources.py: 31 passed on Python 3.11/Linux amd64 WSL. The live HTTP receipt is bracketed by real kernel cumulative-counter reads; it is not a fixture-only parser check.
  • Auth rejection, realistic CPU/memory/I/O file formats, units, partial missing/permission states, genuine zeroes, undefined CPU full, invalid/nonfinite/out-of-range data and existing resource endpoints are covered.
  • Python 3.14 affected suites, scoped pre-commit and git diff --check.

The receipt is sequential, not an atomic sample or historical store; cumulative totals reset with the observed kernel. Native Windows/macOS unavailable behavior is tested with absent files, while their live runtime and Docker Desktop host attribution remain unverified. No pressure threshold or capacity claim is made. Rollback removes this additive read endpoint and parser; no persisted state needs migration. Operator contract: ods/docs/RESOURCE-PRESSURE.md.

Batch integration evidence

This exact candidate is included in the 30-PR integration receipt, on code integration commit a38a38a2303724b2b2a3bfba6324fc40a67154ba over public-beta d49ad4bbc760be319de7f4c9b9a93b1f18fe3922. The receipt lists all candidate SHAs, suggested merge order and additive catalog/README reconciliation.

The integration passed 2,858 API tests (3 skipped), 1,069 UI tests, build/lint, schema and four backend Compose plans. The combined live suite passed 52 cases and hit one Uptime Kuma Docker-start timeout; the unchanged Kuma cases passed in a separate rerun on the same commit. The negative cold-start observation remains recorded. Root/WSL fixture failures and the existing macOS fixture PR #3160 are explicitly separated from passing smoke/simulation checks. These receipts do not qualify every hardware platform or a simultaneous service load.

The report distinguishes completed CI from the queued Memos follow-up. Gitea #4909 remains draft for independent migration review.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

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.

2 participants