Skip to main content

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) and app_dependency_latency_seconds (Histogram)
  • 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")

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

MIT — see LICENSE.

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

dephealth-0.1.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dephealth-0.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file dephealth-0.1.0.tar.gz.

File metadata

  • Download URL: dephealth-0.1.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for dephealth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 402b312ad42a55487c7aff024926854503bf244e7982730d476a9e25ad2fdad8
MD5 4372bc177c1b3bbbf9c26d1416e9482e
BLAKE2b-256 805f2c225be3286ee0cecab4bbac7185cb76cc0fed5b796a4ae2486be6721a7d

See more details on using hashes here.

File details

Details for the file dephealth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dephealth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for dephealth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d08720a7cba7d2503f82562d3e4dfc43f3c40a4a4ada1af942579e29f015a761
MD5 5deb7837f8b9b3c716086c63c0936949
BLAKE2b-256 d30156264b8accc2077c82c43955b6a52ee00ea15073cb1e0394bf59c103e070

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page