SDK for monitoring microservice dependencies via Prometheus metrics
Project description
dephealth
SDK for monitoring microservice dependencies via Prometheus metrics.
Features
- Automatic health checking for dependencies (PostgreSQL, MySQL, Redis, RabbitMQ, Kafka, HTTP, gRPC, TCP)
- Prometheus metrics export:
app_dependency_health(Gauge 0/1),app_dependency_latency_seconds(Histogram),app_dependency_status(enum),app_dependency_status_detail(info) - Async architecture built on
asyncio - FastAPI integration (middleware, lifespan, endpoints)
- Connection pool support (preferred) and standalone checks
Installation
# Basic installation
pip install dephealth
# With specific checkers
pip install dephealth[postgres,redis]
# All checkers + FastAPI
pip install dephealth[all]
Quick Start
Standalone
from dephealth import DepHealth
dh = DepHealth()
dh.add("postgres", url="postgresql://user:pass@localhost:5432/mydb")
dh.add("redis", url="redis://localhost:6379")
await dh.start()
# Metrics are available via prometheus_client
await dh.stop()
FastAPI
from fastapi import FastAPI
from dephealth_fastapi import DepHealthFastAPI
app = FastAPI()
dh = DepHealthFastAPI(app)
dh.add("postgres", url="postgresql://user:pass@localhost:5432/mydb")
Health Details
details = dh.health_details()
for key, ep in details.items():
print(f"{key}: healthy={ep.healthy} status={ep.status} "
f"latency={ep.latency_millis():.1f}ms")
Configuration
| Parameter | Default | Description |
|---|---|---|
interval |
15 |
Check interval (seconds) |
timeout |
5 |
Check timeout (seconds) |
Supported Dependencies
| Type | Extra | URL Format |
|---|---|---|
| PostgreSQL | postgres |
postgresql://user:pass@host:5432/db |
| MySQL | mysql |
mysql://user:pass@host:3306/db |
| Redis | redis |
redis://host:6379 |
| RabbitMQ | amqp |
amqp://user:pass@host:5672/vhost |
| Kafka | kafka |
kafka://host1:9092,host2:9092 |
| HTTP | — | http://host:8080/health |
| gRPC | grpc |
host:50051 (via FromParams) |
| TCP | — | tcp://host:port |
License
Apache License 2.0 — see 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
dephealth-0.4.1.tar.gz
(27.8 kB
view details)
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
dephealth-0.4.1-py3-none-any.whl
(27.4 kB
view details)
File details
Details for the file dephealth-0.4.1.tar.gz.
File metadata
- Download URL: dephealth-0.4.1.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6ebae5cbe44a58a44a9657efc625ad6e70cb77fdf404ba65d910261e771910
|
|
| MD5 |
4d12ebf770cf78516858f78a44e60902
|
|
| BLAKE2b-256 |
8c96ac1fff79ea42fd1211a8aeb3ffd9b14594ea8bc0cc69deba3579ad871892
|
File details
Details for the file dephealth-0.4.1-py3-none-any.whl.
File metadata
- Download URL: dephealth-0.4.1-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb67fff4a5a62a639e050e95daf3469827804e78828ff68e1fb5a30bd1816397
|
|
| MD5 |
e3d35de30bf5645c2d0b6e61a03fc862
|
|
| BLAKE2b-256 |
7e00f46f801d5e438f83780126449a8b774dd682e4438d1e2974df281df4bb12
|