31 lines
750 B
Python
31 lines
750 B
Python
|
|
"""
|
||
|
|
Health check endpoint.
|
||
|
|
[AC-AISVC-20] Health check for service monitoring.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from fastapi import APIRouter, status
|
||
|
|
from fastapi.responses import JSONResponse
|
||
|
|
|
||
|
|
router = APIRouter(tags=["Health"])
|
||
|
|
|
||
|
|
|
||
|
|
@router.get(
|
||
|
|
"/ai/health",
|
||
|
|
operation_id="healthCheck",
|
||
|
|
summary="Health check",
|
||
|
|
description="[AC-AISVC-20] Check if AI service is healthy",
|
||
|
|
responses={
|
||
|
|
200: {"description": "Service is healthy"},
|
||
|
|
503: {"description": "Service is unhealthy"},
|
||
|
|
},
|
||
|
|
)
|
||
|
|
async def health_check() -> JSONResponse:
|
||
|
|
"""
|
||
|
|
[AC-AISVC-20] Health check endpoint.
|
||
|
|
Returns 200 with status if healthy, 503 if not.
|
||
|
|
"""
|
||
|
|
return JSONResponse(
|
||
|
|
status_code=status.HTTP_200_OK,
|
||
|
|
content={"status": "healthy"},
|
||
|
|
)
|