Monitoring: /health for uptime checks, structured error logging, API errors without internal details #90
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/monitoring"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #82, and the API side of #81. The server side (log rotation,
/healththrough the preview gate,scripts/errors.sh, how to set up an uptime monitor) is in the private repo divan-deploy./health(site): asks the API, which asks the database (3 s timeout).200 {"ok":true,"site":"ok","api":"ok","db":"ok","ms":…}when all three answer;503naming the part that is down otherwise;An uptime monitor (UptimeRobot, Better Stack…) checks it and alerts the owner.
API
GET /api/healthchecks the database.{"error":"سرور میں خرابی۔ تھوڑی دیر بعد کوشش کریں۔"}, never the internal message, and are logged with the method, address and the whole error.Site: any error while making a page is logged as one JSON line (time, method, path, message, first lines of the stack). The reader sees the Urdu error page from #88.
Tested with test servers:
db: down;api: down;npm testpasses; one test is skipped by design (it needs the data export).🤖 Generated with Claude Code