INNER CODE UNIT · Python
_storage_health
caipe-io/ai-platform-engineering · ai_platform_engineering/audit_service/main.py:107
def _storage_health(store: LocalAuditStore | S3AuditStore, settings: Settings) -> dict[str, Any]:
# assisted-by Codex Codex-sonnet-4-6
try:
if isinstance(store, LocalAuditStore):
return store.storage_health(
warning_percent=settings.local_disk_warning_percent,
critical_percent=settings.local_disk_critical_percent,
)
return store.storage_health()
except Exception: # noqa: BLE001
_logger.exception("audit storage health check failed")
health: dict[str, Any] = {
"backend": settings.backend,
"status": "down",
"detail": "storage health check failed; see audit-service logs",
}
if settings.backend == "local":
health["local_path"] = settings.local_path