Repository navigation
Conversation
ROHIT-JR
left a comment
There was a problem hiding this comment.
Thanks, the concurrent checks, per-check timeouts and the unchanged health://status shape are good. Two things need to change before merge.
Changes needed
- A hung sync check blocks shutdown. Sync checks now run through
asyncio.to_thread. I tried a check that doestime.sleep(3)withtimeout=0.1. The payload correctly reports "Timed out after 0.1s", butasyncio.run(...)still took 3.0s to finish because it waits for the worker thread. A check that stays hung will also use up the default thread pool as it is polled. Running sync checks in a thread is also a behaviour change for checks that need the main thread (for example a thread-bound DB connection), and the README does not mention it. Please either keep sync checks on the loop (documenting that only async checks are timed out) or run them in a dedicated bounded executor and document the limit. - Timeouts are found by string match. The aggregate uses
message.startswith("Timed out")to tell a timeout from a false result. Use a distinct per-check status (for exampletimeout) so the message text can change safely.
Smaller points
ServerHealthPayloaddeclarestransformsPipeline,sandboxWorkerPoolandspillover, and nothing fills them in. Remove them or populate them.transforms[].detailsis always{}, so the "transform telemetry" is only a name list for now. Say so in the README or add real details.importlib.metadata.versionruns on every request, and the fallback isserver_config.version(the app's version, not the SDK's). Compute it once and fall back to the SDK's__version__.errorchecks returnstr(exc)to any client that can read the resource. This is already true forhealth://status, but consider a generic message here.assert elapsed < 0.3in the timeout test may be flaky on a loaded CI runner.
ROHIT-JR
left a comment
There was a problem hiding this comment.
Thanks, both blockers are fixed. Approving.
I re-ran my hung-check script (time.sleep(3), timeout=0.1) on the new head. asyncio.run now returns in 0.1s (it was 3.0s), the check reports status timeout, the other checks are unaffected, and tests/test_health_async_checks.py passes (7). The distinct timeout status, the generic error message on health://checks, the dead payload fields removed, the SDK version resolved once, and the README note about thread-bound resources all look good. CI is green on 3.10 to 3.12.
Two small, non-blocking notes:
- The pool threads are non-daemon, so a check that never returns still delays process exit until it finishes (my script took 3.7s in total). That is much better than before and is a reasonable trade-off, but it is worth one line in the README.
- The
__version__fallback is hard-coded to"0.3.2"and will drift. Reading it frompyproject.toml, or reporting"unknown", would be safer.
Summary
Adds a detailed health://checks resource with overall status, per-check results and latency, uptime, SDK version, timestamp, and transform telemetry. Checks run concurrently with configurable timeouts. The existing health://status response shape remains compatible.
closes #71
Verification