feat(api): add health check endpoints with appropriate tags for service monitoring
This commit is contained in:
@@ -41,6 +41,12 @@ if TYPE_CHECKING:
|
|||||||
configure_logging()
|
configure_logging()
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
OPENAPI_TAGS = [
|
OPENAPI_TAGS = [
|
||||||
|
{
|
||||||
|
"name": "health",
|
||||||
|
"description": (
|
||||||
|
"Service liveness/readiness probes used by infrastructure and runtime checks."
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "agent",
|
"name": "agent",
|
||||||
"description": (
|
"description": (
|
||||||
@@ -112,19 +118,19 @@ else:
|
|||||||
install_error_handling(app)
|
install_error_handling(app)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/health")
|
@app.get("/health", tags=["health"])
|
||||||
def health() -> dict[str, bool]:
|
def health() -> dict[str, bool]:
|
||||||
"""Lightweight liveness probe endpoint."""
|
"""Lightweight liveness probe endpoint."""
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/healthz")
|
@app.get("/healthz", tags=["health"])
|
||||||
def healthz() -> dict[str, bool]:
|
def healthz() -> dict[str, bool]:
|
||||||
"""Alias liveness probe endpoint for platform compatibility."""
|
"""Alias liveness probe endpoint for platform compatibility."""
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/readyz")
|
@app.get("/readyz", tags=["health"])
|
||||||
def readyz() -> dict[str, bool]:
|
def readyz() -> dict[str, bool]:
|
||||||
"""Readiness probe endpoint for service orchestration checks."""
|
"""Readiness probe endpoint for service orchestration checks."""
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|||||||
Reference in New Issue
Block a user