Skip to content

Full health report at GET /api/internal/health - #20

Merged
jadhavgaurav merged 1 commit into
mainfrom
develop
Nov 4, 2026
Merged

jadhavgaurav merged 1 commit into
mainfrom
develop

Conversation

@jadhavgaurav

Copy link
Copy Markdown
Contributor

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.

/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.
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
idraft-preview Ready Ready Preview Nov 4, 2026 8:08am UTC
1 Skipped Deployment
Project Deployment Actions Updated
idraft-site Ignored Ignored Preview Nov 4, 2026 8:08am UTC

Request Review

@jadhavgaurav
jadhavgaurav merged commit c597acf into main Nov 4, 2026
3 of 4 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