Skip to content

Add cross-platform health check fallbacks#48

Open
bingmokaka wants to merge 1 commit into
weilixiong:mainfrom
bingmokaka:health-check-cross-platform-fallbacks
Open

Add cross-platform health check fallbacks#48
bingmokaka wants to merge 1 commit into
weilixiong:mainfrom
bingmokaka:health-check-cross-platform-fallbacks

Conversation

@bingmokaka

Copy link
Copy Markdown

Summary

Adds cross-platform fallbacks for the health check memory and load probes so non-Linux environments can report useful diagnostics when /proc is unavailable.

Changes

  • Kept the existing Linux /proc/meminfo and /proc/loadavg paths intact.
  • Added a Windows memory fallback using standard-library ctypes and GlobalMemoryStatusEx.
  • Added a POSIX-style memory fallback using os.sysconf where available.
  • Added a load average fallback using os.getloadavg() where available.
  • Added focused unittest coverage that simulates missing /proc files and verifies fallback behavior.

Testing

  • python -m unittest tests.test_health_check_fallbacks -v passes: 5 tests.
  • python tools/health_check.py --json --service backend preserves JSON output shape; memory reports a meaningful Windows value.
  • PYTHONIOENCODING=utf-8 python tools/health_check.py --service backend preserves text output shape; memory reports a meaningful Windows value.
  • python build.py was attempted but the Windows environment lacks the full multi-language toolchain and npm, so the all-module build crashes when spawning npm install for frontend.
  • python build.py -m backend was also attempted; it reached diagnostic finalization but failed because the bundled encryptly diagnostic pack step returned an error in this Windows environment. No new diagnostic artifact was committed.

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

Closes #1

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.

[$50 BOUNTY] [Python] Add cross-platform health check fallbacks

1 participant