ADR 001: Health check contract (DSN, name, lifecycle)¶
Status¶
Accepted.
Context¶
Check classes need a consistent contract for DSN handling, display names, and client lifecycle.
Decision¶
- DSN:
fast_healthchecks.dsnprovides NewTypes (AmqpDsn, RedisDsn, etc.) for typing only. EachHealthCheckDSNsubclass implementsparse_dsn()andvalidate_dsn(); no shared DSN runtime logic. - Name: All checks expose
_name(str), used inHealthCheckResultand error reporting._get_check_name()falls back tonameor"Check-{index}". - Lifecycle:
ClientCachingMixin._close_client(client)must returnAwaitable[None](notNone). Per-call checks (RabbitMQ, PostgreSQL) do not useClientCachingMixin. - Config: Connection-based checks accept an optional
config: XConfig | None; whenNone, config is built from**kwargs. Config dataclasses live infast_healthchecks.checks.configs, are immutable (frozen), and provideto_dict()for serialization. This avoids long parameter lists and centralizes_build_dict()logic.