Skip to main content

Healthcheck

CI PyPI publish License: MIT

Healthcheck is a small sidecar-style process that exposes liveness and readiness HTTP endpoints. It listens for StatsD-style UDP gauges (for example gunicorn.workers) so the HTTP layer can reflect how many workers are alive.

Requirements

  • Python 3.12 or newer

Install

From PyPI:

pip install approck-healthcheck

The importable Python package remains healthcheck (for example python -m healthcheck, from healthcheck.application import create_application).

From a git checkout with uv:

uv sync --locked
uv run healthcheck --help

Run

uv run healthcheck --host 0.0.0.0 --port 8001
# or
python -m healthcheck --host 0.0.0.0 --port 8001

Integrations

Gevent

The healthcheck CLI starts a Gevent WSGIServer for /health/* and a UDP StatsD listener on the configured host and port. Your workers (or Gunicorn hooks) should emit gauge metrics named workers or gunicorn.workers so liveness reflects the worker count.

Gunicorn

Add Gunicorn hooks to your gunicorn.conf.py:

from healthcheck.gunicorn.hooks import *

# gunicorn.conf.py goes here
# ...

Command line

usage: healthcheck [-h] [-H HOST] [-P PORT] [--statsd-host STATSD_HOST]
                   [--statsd-port STATSD_PORT]
                   [--application-health-ready-url URL] [-v]

A simple "sidecar" healthcheck application. It uses the statsD protocol over
UDP to receive metrics and provides liveness and readiness HTTP endpoints.

options:
  -h, --help            show this help message and exit
  -H HOST, --host HOST  The host that the server should bind on (default:
                        localhost).
  -P PORT, --port PORT  The port that the server should bind on (default:
                        8000).
  --statsd-host STATSD_HOST
                        The host of the statsd server (default: localhost).
  --statsd-port STATSD_PORT
                        The port of the statsd server (default: 8125).
  --application-health-ready-url URL
                        The application URL which provides a readiness status
                        (optional).
  -v, --verbose         Activate verbose output to the console and specify the
                        level of detail.

REST API

  • GET /health/live

    Liveness probe — indicates whether the process considers workers available.

    Status codes:

    • 200 — workers gauge is positive.
    • 422 — no workers reported (NoWorkers).

    Error JSON:

    • code (string), e.g. NoWorkers.
    • description (string).
  • GET /health/ready

    Readiness probe — same worker gate as liveness; if --application-health-ready-url is set, the handler proxies JSON from that URL or returns ServiceNotReady on non-200 responses.

    Status codes:

    • 200 — ready (including proxied JSON from the application URL when configured).
    • 422 — not ready.

Development

Clone the repository, then install dependencies (uses the committed uv.lock) and run checks:

uv sync --locked
uv run ruff check healthcheck tests
uv run ruff format --check healthcheck tests
uv run pytest

To refresh dev dependencies and regenerate the lockfile:

uv lock --upgrade

To apply Ruff formatting (instead of only checking):

uv run ruff format healthcheck tests

Contributing

Issues and pull requests (including from forks) are welcome. Please run uv run ruff check, uv run ruff format --check, and uv run pytest before submitting a change.

License

MIT — see LICENSE.

Metadata

Release files for approck-healthcheck 1.0.13

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

Source distribution (sdist)

Source distribution for approck-healthcheck 1.0.13
File Size Uploaded Provenance
approck_healthcheck-1.0.13.tar.gz 6.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for approck-healthcheck 1.0.13
File Interpreter ABI Platform
approck_healthcheck-1.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / approck_healthcheck-1.0.13.tar.gz

Download URL approck_healthcheck-1.0.13.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17ee7c24dcf4ae9263a338e2713748175fe567abdc8d7599f5887a57f96e5550
BLAKE2b-256 checksum
How to use checksums
9418ca6bf857778c1bed1e8fcf9bd99798974022d0b62fb815179cddbfc03c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / approck_healthcheck-1.0.13-py3-none-any.whl

Download URL approck_healthcheck-1.0.13-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fe42bfb93194ee8fa08eb65f9de8bfe45004af99204b60336560620cfd3ca33
BLAKE2b-256 checksum
How to use checksums
d86ad3b5a4fb30031144539f459b47183ea416ca3a22d717a72ec941bafec385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for approck-healthcheck 1.0.13

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.

Release history Release notifications | RSS feed

This release

1.0.13 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