Spaces:
Runtime error
Runtime error
from loguru import logger | |
from pydantic import ConfigDict | |
from types import MappingProxyType | |
from typing import Collection, Mapping, Self | |
from ctp_slack_bot.core import ApplicationComponentBase, HealthReportingApplicationComponentBase | |
class ApplicationHealthService(ApplicationComponentBase): | |
""" | |
Service for checking and reporting application health. | |
""" | |
model_config = ConfigDict(frozen=True) | |
services: list[HealthReportingApplicationComponentBase] | |
async def get_health(self: Self) -> Mapping[str, bool]: | |
return MappingProxyType({service.name: await service.is_healthy() | |
for service | |
in self.services}) | |
def name(self: Self) -> str: | |
return "application_health_service" | |