Initial commit: Virtual Board Member AI System foundation
This commit is contained in:
76
app/api/v1/endpoints/health.py
Normal file
76
app/api/v1/endpoints/health.py
Normal file
@@ -0,0 +1,76 @@
|
||||
"""
|
||||
Health check endpoints for monitoring system status.
|
||||
"""
|
||||
|
||||
from typing import Dict, Any
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.database import get_db, check_db_health
|
||||
from app.core.config import settings
|
||||
import structlog
|
||||
|
||||
logger = structlog.get_logger()
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/")
|
||||
async def health_check() -> Dict[str, Any]:
|
||||
"""Basic health check endpoint."""
|
||||
return {
|
||||
"status": "healthy",
|
||||
"version": settings.APP_VERSION,
|
||||
"environment": settings.ENVIRONMENT,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/detailed")
|
||||
async def detailed_health_check(
|
||||
db: AsyncSession = Depends(get_db)
|
||||
) -> Dict[str, Any]:
|
||||
"""Detailed health check with database connectivity."""
|
||||
|
||||
# Check database health
|
||||
db_healthy = await check_db_health()
|
||||
|
||||
# TODO: Add checks for other services (Redis, Qdrant, etc.)
|
||||
|
||||
overall_status = "healthy" if db_healthy else "unhealthy"
|
||||
|
||||
return {
|
||||
"status": overall_status,
|
||||
"version": settings.APP_VERSION,
|
||||
"environment": settings.ENVIRONMENT,
|
||||
"services": {
|
||||
"database": "healthy" if db_healthy else "unhealthy",
|
||||
"redis": "unknown", # TODO: Implement Redis health check
|
||||
"qdrant": "unknown", # TODO: Implement Qdrant health check
|
||||
"llm": "unknown", # TODO: Implement LLM health check
|
||||
},
|
||||
"features": {
|
||||
"commitment_tracking": settings.FEATURE_COMMITMENT_TRACKING,
|
||||
"risk_analysis": settings.FEATURE_RISK_ANALYSIS,
|
||||
"meeting_support": settings.FEATURE_MEETING_SUPPORT,
|
||||
"real_time_queries": settings.FEATURE_REAL_TIME_QUERIES,
|
||||
"batch_processing": settings.FEATURE_BATCH_PROCESSING,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/ready")
|
||||
async def readiness_check() -> Dict[str, Any]:
|
||||
"""Readiness check for Kubernetes."""
|
||||
# TODO: Implement comprehensive readiness check
|
||||
return {
|
||||
"status": "ready",
|
||||
"timestamp": "2025-01-01T00:00:00Z",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/live")
|
||||
async def liveness_check() -> Dict[str, Any]:
|
||||
"""Liveness check for Kubernetes."""
|
||||
return {
|
||||
"status": "alive",
|
||||
"timestamp": "2025-01-01T00:00:00Z",
|
||||
}
|
||||
Reference in New Issue
Block a user