FastAPI Healthchecks
Project description
FastAPI health checks
Configurable health checks endpoints for FastAPI applications.
Quickstart
app = FastAPI()
app.include_router(
HealthcheckRouter(
Probe(
name="readiness",
checks=[
PostgreSqlCheck(host="db.example.com", username=..., password=...),
RedisCheck(host="redis.example.com", username=..., password=...),
],
),
Probe(
name="liveness",
checks=[
...,
],
),
),
prefix="/health",
)
The probes from this example will be available as GET /health/readiness
and GET /health/liveness
.
Bundled checks
PostgreSqlCheck
– checks PostgreSQL server availabilityRedisCheck
– checks Redis server availabilityRabbitMqCheck
– checks RabbitMQ server availabilitySettingsCheck
– validates settings models based on pydantic BaseModelHttpCheck
– checks availability of specified URLCephCheck
– checks Ceph server availability
Custom checks
You can create your own checks by providing custom fastapi_healthchecks.checks.Check
implementations. Like this:
class MaintenanceCheck(Check):
async def __call__(self) -> CheckResult:
if is_maintenance():
return CheckResult(name="Maintenance", passed=False, details="Closed for maintenance")
else:
return CheckResult(name="Maintenance", passed=True)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi_healthchecks-1.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aa229b8cf3109e7fc46083fb5180a058a55945072a202db18ca417d1eed3cd3 |
|
MD5 | f781fe6f64893a529b581fe10a05fd91 |
|
BLAKE2b-256 | 314b54ca3741249efc441930e63d267abc109acce03e44003a61dfa67b7369de |
Close
Hashes for fastapi_healthchecks-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c568bc84c0bf77470b268c14e76d09bad09d995e5cad91099ae40b5c79110d30 |
|
MD5 | 74d1611f26e0383ff48b7fce6e636877 |
|
BLAKE2b-256 | 59259ed56d418a9d7081e2ae8da74f6b6f6473ab37965b177f4ac440211cadbc |