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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e098fb7a2f273be8e671f715a48e0cc9469983e8a7346a15d7043ddc110546c4 |
|
MD5 | 8009005890703556c99f25a8c143d1d3 |
|
BLAKE2b-256 | d252caec6d807a0ff63ca58c917e7502c7acf7aafcd2a62b6facd72c7d507069 |
Close
Hashes for fastapi_healthchecks-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b14b7b9ef7d121eb9067109f9bec67995aa23297f6f3e86e80891935b260b78 |
|
MD5 | 197930bd345469ae0d26ec8bb2e81309 |
|
BLAKE2b-256 | 8a233620f007304f6db49c63ddec1d999b892dd45f67c7eeb0e665bcccf094eb |