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
File details
Details for the file fastapi_healthchecks-1.1.0.tar.gz
.
File metadata
- Download URL: fastapi_healthchecks-1.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/5.15.0-82-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a2b12b9e18dadda78888cda4c0834fc6d3a4552e3a2c4ffad840f6e1dca24e3 |
|
MD5 | 8b73a477e4a0d6f48768fb7c09defd83 |
|
BLAKE2b-256 | a04917cee6fdca63962129b65352eb42107878c778becf74b0354a10048f5d69 |
File details
Details for the file fastapi_healthchecks-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_healthchecks-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/5.15.0-82-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c75e5c7abddeb806ffd95219a73ab79d66435e47197ed4d710fd7f48af382c5 |
|
MD5 | 073e8c1a7a005f644b5364dd88a9bee0 |
|
BLAKE2b-256 | fe0d7e2dc4363e52bb39fadb9314d6a755ff53263a4e389e551bd9bd0516ab18 |