community-of-python / microbootstrap

Bootstrap your microservices in a second!
27 stars 2 forks source link

Add healthchecks support #5

Closed insani7y closed 2 weeks ago

insani7y commented 3 months ago

Add health checks to litestar and fastapi after healthchecks package is moved to opensource

vrslev commented 3 weeks ago

@insani7y Currently we have this defined in ~100% services:

import typing

from health_checks.http_based import DefaultHTTPHealthCheck
from health_checks.litestar_healthcheck import build_litestar_health_check_router

from service.settings import settings

HEALTH_CHECKS_ROUTER: typing.Final = build_litestar_health_check_router(
    health_check=DefaultHTTPHealthCheck(
        service_version=settings.service_version,
        service_name=settings.service_name,
    )
)

Do you think we should continue using DefaultHTTPHealthCheck, or some sotisficated configuration is needed?

insani7y commented 2 weeks ago

Yeah, i think, it would be good to have a health_check_enabled param to toggle this functionality. service_version and service_name will be passed down, so, all the same, but less boilerplate