generated from coulomb/repo-seed
Add S3 backend and storage verification
This commit is contained in:
@@ -176,7 +176,12 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
async def health(registry: Registry = Depends(get_registry)) -> dict[str, Any]:
|
||||
db_ok, db_detail = await registry.db_health()
|
||||
backend_status = await registry.backend_health()
|
||||
overall = "ok" if db_ok and backend_status.healthy else "degraded"
|
||||
failed_storage_locations = await registry.failed_storage_locations_count()
|
||||
overall = (
|
||||
"ok"
|
||||
if db_ok and backend_status.healthy and failed_storage_locations == 0
|
||||
else "degraded"
|
||||
)
|
||||
return {
|
||||
"service": "artifact-store",
|
||||
"version": __version__,
|
||||
@@ -189,6 +194,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
"free_bytes": backend_status.free_bytes,
|
||||
"total_bytes": backend_status.total_bytes,
|
||||
},
|
||||
"storage": {"failed_locations": failed_storage_locations},
|
||||
}
|
||||
|
||||
@application.get("/backends")
|
||||
@@ -196,7 +202,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
_actor: str = Depends(require_read_auth),
|
||||
registry: Registry = Depends(get_registry),
|
||||
) -> dict[str, Any]:
|
||||
backend_status = await registry.backend_health()
|
||||
statuses = await registry.backend_health_all()
|
||||
return {
|
||||
"backends": [
|
||||
{
|
||||
@@ -206,6 +212,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
"free_bytes": backend_status.free_bytes,
|
||||
"total_bytes": backend_status.total_bytes,
|
||||
}
|
||||
for backend_status in statuses
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user