Skip to main content

healthz

Interactive HTTP health monitoring tool with real-time metrics visualization and per-second granularity.

Monitor your APIs, detect blocking in async services, and find performance bottlenecks with a beautiful terminal UI inspired by btop.

Features

  • 🚀 Constant-rate load testing - Send requests at exact intervals (no batching)
  • 📊 Per-second metrics - True temporal granularity for p95/p99 latency
  • 📈 Real-time graphs - Symmetrical butterfly chart showing p99/p95 trends
  • ⌨️ Interactive controls - Adjust rate and window on-the-fly without restart
  • 🎯 Blocking detection - Track pending requests and timeouts to detect event loop saturation
  • 💾 Export data - Save per-second aggregated metrics to CSV
  • 🎨 Nord-themed UI - Beautiful color scheme optimized for terminals

Installation

# Install from PyPI
pip install healthz

# Or install from source
git clone https://github.com/Delos-Intelligence/healthz.git
cd healthz
pip install -e .

Usage

Basic

# Monitor a health endpoint at 30 requests/second
healthz http://localhost:8000/healthz --rate 30

Advanced

# POST request with custom headers
healthz http://api.example.com/endpoint \
  --rate 50 \
  --method POST \
  --header "Authorization: Bearer token" \
  --data '{"check": true}'

Interactive Controls

While the TUI is running:

Key Action
↑ / + Increase request rate (+10 req/s)
↓ / - Decrease request rate (-10 req/s)
w Increase time window (+5s)
s Decrease time window (-5s)
p Pause/resume sending requests
r Reset all statistics
e Export per-second metrics to CSV
q Quit

Display

The TUI shows four panels:

  1. Metrics Panel (top): Request counts, success rate, pending requests with health status indicator
  2. Response Time Stats (left): Min, Avg, p50, p95, p99, Max latency with color coding
  3. Distribution Histogram (right): Response time distribution across buckets
  4. Butterfly Chart (bottom): Symmetrical p99 (top) / p95 (bottom) time-series graph

Health Status Colors

  • 🟢 Green (Healthy): Pending < rate
  • 🟡 Yellow (Degraded): Pending < rate × 3
  • 🔴 Red (Blocked): Pending ≥ rate × 3

Use Cases

Detect Blocking in Async Services

Monitor /healthz while load testing other endpoints to detect when your async event loop gets saturated:

# Terminal 1: Monitor health check
healthz http://localhost:8000/healthz --rate 30

# Terminal 2: Load your API
while true; do
  curl -X POST http://localhost:8000/api/endpoint \
    -H "Content-Type: application/json" \
    -d '{"data": "test"}'
done

If the health check starts showing high pending counts or timeouts, your service is blocking!

Find Resource Limits

Gradually increase the rate to find when your service starts degrading:

  1. Start at low rate: healthz URL --rate 10
  2. Press ↑ repeatedly to increase rate
  3. Watch for pending count to rise or p95/p99 to spike
  4. That's your service's limit!

Compare Before/After

Export baseline metrics, make code changes, run again and compare:

# Before optimization
healthz http://localhost:8000/healthz --rate 50
# Press 'e' to export to healthz_metrics_YYYYMMDD_HHMMSS.csv

# After optimization
healthz http://localhost:8000/healthz --rate 50
# Press 'e' to export again and compare

Architecture

healthz uses a per-second bucket architecture for efficient memory usage:

  • Each second gets a SecondBucket storing aggregated stats (success/timeout/error counts, response times)
  • When a response arrives, it updates the bucket for the second the request was sent (not completed)
  • All displays (metrics, histogram, graph) read from these buckets
  • Individual request objects are never stored - only aggregated data
  • Old buckets (>5 minutes) are automatically cleaned up

This means you get accurate per-second granularity while using minimal memory.

Development

# Clone and install in development mode
git clone https://github.com/Delos-Intelligence/healthz.git
cd healthz
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black healthz/
ruff check healthz/

Requirements

  • Python 3.10+
  • aiohttp
  • textual
  • textual-plotext
  • click

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for healthz 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for healthz 0.1.1
File Size Uploaded Provenance Actions
healthz-0.1.1.tar.gz 16.2 kB Without provenance Details for healthz-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for healthz 0.1.1
File Interpreter ABI Platform Actions
healthz-0.1.1-py3-none-any.whl Python 3 none any Details for healthz-0.1.1-py3-none-any.whl

Total release size: 33.3 kB

Release files / healthz-0.1.1.tar.gz

Download URL healthz-0.1.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c3b10db2d44ffa5d70c0749dac9f2773ec63cf179e9e9450b4983242f3ea6527
BLAKE2b-256 checksum
How to use checksums
36a0e0344ad3c2c42a13383d27609904d2b0e3bf24bdb46568a52d17530e36b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.7 Linux/6.12.51-1-lts

Release files / healthz-0.1.1-py3-none-any.whl

Download URL healthz-0.1.1-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afa921f1c5e1a6ffe73f675d0ce8a17881df20d49731e8031a15391702ed64bc
BLAKE2b-256 checksum
How to use checksums
3ba6e469f4fe33941f4d6c69fd45e3e2de0f621bb6afd2923fa4fe79a8b9f009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.7 Linux/6.12.51-1-lts

Security for healthz 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page