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.2.2.tar.gz (23.0 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.2.2-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dephealth-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0b5d5c7294264c5690139828809daec8f4e4c8cc1aa194797448c0a3720b0e2b
MD5 9b666c5bbfcca2a3df0b666c86249cef
BLAKE2b-256 e1aaf44d38f0efb62cd8024e9cc7d4f4305f914533affb680b89ec9805dc2fe4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dephealth-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.5 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bcfc0e6a6f210e66b38d3886d172142b9d22e84c502985e9b4be12acfd0e88f0
MD5 bc5a478611465354a6b0ca9c8a884a1b
BLAKE2b-256 39817a48e067d9a9218543e935f1dde2f5856b68465b4931dce0edab50d5b296

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