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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac3626cb5d027dbe0837a95d101862fe1738135a95dda371d251866ecbfe8b25 |
|
MD5 | 66c25bc6855e53c563eb2dcfcea69151 |
|
BLAKE2b-256 | 5e62c6c8cd84a62e154ecf92c05a2cb6f55b17910c67e8308766606f58790aae |
Close
Hashes for fastapi_healthchecks-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9021bf19478cb6b09df9159232e52097e951880c81d652cd8efb1f2a8c62175e |
|
MD5 | bf82df040deca4b42b24a7f3cbe1cacc |
|
BLAKE2b-256 | 890ecd725d2c6f3227566730a0964f5123887f32051eb75ea77380f90957c0ba |