Spaces:
Runtime error
Runtime error
File size: 822 Bytes
a1a6d79 f0fe0fd a1a6d79 f0fe0fd a1a6d79 f0fe0fd a1a6d79 f0fe0fd a1a6d79 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from aiohttp.web import json_response, Request, Response
from pydantic import ConfigDict
from typing import Self
from .base import ControllerBase, controller, get
from ctp_slack_bot.services import ApplicationHealthService
@controller("/health")
class ApplicationHealthController(ControllerBase):
"""
Application health reporting endpoints.
"""
model_config = ConfigDict(frozen=True)
application_health_service: ApplicationHealthService
@get("")
async def get_health(self: Self, request: Request) -> Response:
health_statuses = await self.application_health_service.get_health()
return json_response(dict(health_statuses), status=200 if all(health_statuses.values()) else 503)
@property
def name(self: Self) -> str:
return "application_health_controller"
|