aaa / app /api /v2 /monitoring.py
work-sejal
Deploy AI service with FastAPI
70ea7be
Raw
History Blame Contribute Delete
972 Bytes
"""Monitoring API router.
GET /ai/v2/monitoring/model-health — returns status of all loaded models
with metrics and prediction stats.
"""
from fastapi import APIRouter, Depends
from app.api.v2.dependencies import get_monitoring_service
from app.schemas.monitoring import MonitoringResponse
from app.services.monitoring_service import MonitoringService
router = APIRouter(prefix="/ai/v2", tags=["monitoring"])
@router.get(
"/monitoring/model-health",
response_model=MonitoringResponse,
summary="Model Health",
description=(
"Return status of all loaded models with metrics and prediction stats. "
"Reports model version, last trained date, key metrics, "
"and prediction counts for the last 24 hours."
),
)
async def get_model_health(
service: MonitoringService = Depends(get_monitoring_service),
) -> MonitoringResponse:
"""Return health status of all registered models."""
return service.get_model_health()