Add a health‑check endpoint for container orchestration - #88
Closed
kael-developer[bot] wants to merge 1 commit into
Closed
Add a health‑check endpoint for container orchestration#88kael-developer[bot] wants to merge 1 commit into
kael-developer[bot] wants to merge 1 commit into
Conversation
Implemented by Kael AI Agent
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.
Context
Problem
Kubernetes or other orchestrators have no way to verify that the SDLC service is healthy; missing liveness/readiness probes can cause downtime or slow recovery.
Solution
Expose a
/healthzGET endpoint that returns HTTP 200 with JSON indicating overall status and sub‑checks (database connectivity, scheduler thread alive, message broker if used). Integrate this endpoint into the Dockerfile with aHEALTHCHECKdirective.Value
Enables automated health monitoring, rapid detection of failures, and smooth restarts in production environments.
Implementation notes
In the FastAPI app, add a route that runs quick sanity checks (e.g.,
engine.is_running(),db.session.execute('SELECT 1')). Return{ "status": "ok", "checks": { "db": true, "scheduler": true } }. Update the Dockerfile to includeHEALTHCHECK --interval=30s --timeout=5s CMD curl -f http://localhost:8000/healthz || exit 1. Add unit tests for the health endpoint.Priority: P1
Implementation summary
We need to add healthHandler function above maybe after imports. Need to import net/http and encoding/json already imported. Already have net/http imported. At top imports line 3 included net/http. Good.
Add function before main or after generateID. Let's add after generateID for readability.
We need to edit file inserting new function. Use edit_file with context near end. Provide old snippet unique: maybe the closing brace of file. Let's open last few lines.
Closes #85