Repository navigation
Full health report at GET /api/internal/health - #20
Merged
Merged
Conversation
/api/healthz and /api/readyz stay public and minimal. The full report is for the people who run the system, so it needs a bearer token (HEALTH_TOKEN, at least 24 characters, compared in constant time); without one the route does not exist (404), and a wrong token is 401. It reports PostgreSQL and Redis with latency, the schema revision against the expected head, the worker processes that reported in the last 90 seconds, the DataForSEO state (registered, paused, last balance), collection across all workspaces (open tasks, oldest due age, failures in 24 hours, last ingest) and the versions. down (PostgreSQL, Redis or the schema failing) is 503; degraded (no worker, provider paused or critical, a due task waiting over an hour) is 200. What cannot be seen is null. The API's database role cannot read the task ledger across workspaces, so each worker process writes its own report to Redis every 30 seconds (90 seconds to live) and the report reads those. The status tick is bounded so a database that does not answer cannot hold a stop. Tests for the endpoint, the worker report and the settings; API spec section 3.12 and .env.example updated. Not in the OpenAPI document.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
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.
Adds a token-protected full health report. /api/healthz and /api/readyz stay public and minimal.
GET /api/internal/health (Authorization: Bearer HEALTH_TOKEN; 404 without a token configured, 401 for a wrong one) reports PostgreSQL and Redis with latency, the schema revision against the head, the worker processes that reported lately, the DataForSEO state (registered, paused, last balance), collection across workspaces and the versions. down is 503, degraded is 200, what cannot be seen is null.
Each worker process now writes a small report to Redis every 30 seconds (90 seconds to live) because the API's database role cannot read the task ledger across workspaces.
Backend only; not in the OpenAPI document; no migration.