FastHealthchecks
Project description
FastHealthcheck
Framework agnostic health checks with integrations for most popular ASGI frameworks: FastAPI / Faststream / Litestar to help you to implement the Health Check API pattern
Installation
With pip:
pip install fast-healthchecks
With poetry:
poetry add fast-healthchecks
With uv:
uv add fast-healthchecks
Quick Start
Examples:
import asyncio
import os
import time
from fastapi import FastAPI
from fast_healthchecks.checks.function import FunctionHealthCheck
from fast_healthchecks.checks.kafka import KafkaHealthCheck
from fast_healthchecks.checks.mongo import MongoHealthCheck
from fast_healthchecks.checks.postgresql.asyncpg import PostgreSQLAsyncPGHealthCheck
from fast_healthchecks.checks.postgresql.psycopg import PostgreSQLPsycopgHealthCheck
from fast_healthchecks.checks.rabbitmq import RabbitMQHealthCheck
from fast_healthchecks.checks.redis import RedisHealthCheck
from fast_healthchecks.checks.url import UrlHealthCheck
from fast_healthchecks.integrations.fastapi import HealthcheckRouter, Probe
def sync_dummy_check() -> bool:
time.sleep(0.1)
return True
async def async_dummy_check() -> bool:
await asyncio.sleep(0.1)
return True
app = FastAPI()
app.include_router(
HealthcheckRouter(
Probe(
name="liveness",
checks=[
FunctionHealthCheck(func=sync_dummy_check, name="Sync dummy"),
],
),
Probe(
name="readiness",
checks=[
KafkaHealthCheck(
bootstrap_servers=os.environ["KAFKA_BOOTSTRAP_SERVERS"],
name="Kafka",
),
MongoHealthCheck.from_dsn(os.environ["MONGO_DSN"], name="Mongo"),
PostgreSQLAsyncPGHealthCheck.from_dsn(os.environ["POSTGRES_DSN"], name="PostgreSQL asyncpg"),
PostgreSQLPsycopgHealthCheck.from_dsn(os.environ["POSTGRES_DSN"], name="PostgreSQL psycopg"),
RabbitMQHealthCheck.from_dsn(os.environ["RABBITMQ_DSN"], name="RabbitMQ"),
RedisHealthCheck.from_dsn(os.environ["REDIS_DSN"], name="Redis"),
UrlHealthCheck(url="https://httpbingo.org/status/200", name="URL 200"),
],
),
Probe(
name="startup",
checks=[
FunctionHealthCheck(func=async_dummy_check, name="Async dummy"),
],
),
debug=True,
prefix="/health",
),
)
Development
Setup environment
git clone https://github.com/shepilov-vladislav/fast-healthchecks.git
cd fast-healthchecks
uv sync --group=dev --group=docs --all-extras
Run linters
make lint
Run all tests
make tests-all
Serve documentation
make serve-docs
Known alternatives
License
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_healthchecks-0.2.4.tar.gz.
File metadata
- Download URL: fast_healthchecks-0.2.4.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3c08f6725a45921d543ae9d5bb9323e283a7de0226f0f2cc085b450392d044
|
|
| MD5 |
27c93beb1b74084541adddbd92e17025
|
|
| BLAKE2b-256 |
dc67ca837c9a6e6b45d7565820ccf4f13b7b3d224b72255972c3a2bdef221b34
|
Provenance
The following attestation bundles were made for fast_healthchecks-0.2.4.tar.gz:
Publisher:
4_pythonpublish.yaml on shepilov-vladislav/fast-healthchecks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_healthchecks-0.2.4.tar.gz -
Subject digest:
5c3c08f6725a45921d543ae9d5bb9323e283a7de0226f0f2cc085b450392d044 - Sigstore transparency entry: 542010281
- Sigstore integration time:
-
Permalink:
shepilov-vladislav/fast-healthchecks@5e544fc6ccb21105ad04456e60854062a42693b7 -
Branch / Tag:
refs/tags/0.2.4 - Owner: https://github.com/shepilov-vladislav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
4_pythonpublish.yaml@5e544fc6ccb21105ad04456e60854062a42693b7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_healthchecks-0.2.4-py3-none-any.whl.
File metadata
- Download URL: fast_healthchecks-0.2.4-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a1aa4aaf0b29c604d5f8529aa75e41d581e157c4a46041d9c3d577844b8a79
|
|
| MD5 |
cb98f739705f0800c342e1e8efbf1fe4
|
|
| BLAKE2b-256 |
648a437ecf013aa150db6122071d7cd10722f3d966ebc9c68c8797ed70532804
|
Provenance
The following attestation bundles were made for fast_healthchecks-0.2.4-py3-none-any.whl:
Publisher:
4_pythonpublish.yaml on shepilov-vladislav/fast-healthchecks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_healthchecks-0.2.4-py3-none-any.whl -
Subject digest:
04a1aa4aaf0b29c604d5f8529aa75e41d581e157c4a46041d9c3d577844b8a79 - Sigstore transparency entry: 542010302
- Sigstore integration time:
-
Permalink:
shepilov-vladislav/fast-healthchecks@5e544fc6ccb21105ad04456e60854062a42693b7 -
Branch / Tag:
refs/tags/0.2.4 - Owner: https://github.com/shepilov-vladislav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
4_pythonpublish.yaml@5e544fc6ccb21105ad04456e60854062a42693b7 -
Trigger Event:
push
-
Statement type: