Skip to main content

Streamlit HealthCheck

Python | PyPI | codecov | On Pull Request

Monitor, visualize, and manage the health of your Streamlit multi-page applications with ease.


Overview

Streamlit HealthCheck is a comprehensive health monitoring solution for Streamlit apps. It tracks system resources, external dependencies, and custom application checks, providing a real-time dashboard for operational insights and troubleshooting.

  • System Resource Monitoring: CPU, memory, disk usage with configurable thresholds
  • Dependency Checks: API endpoints and database connectivity status
  • Custom Health Checks: Easily register and visualize custom checks for your app
  • Streamlit Page Error Tracking: Detects exceptions and st.error calls across pages
  • Live Dashboard: Interactive Streamlit UI with tabs for system, dependencies, custom checks, and page errors
  • Configurable: All checks and thresholds are managed via a simple JSON config file

How to Set Up & Run

Follow these steps to set up and launch the Streamlit HealthCheck dashboard using the status_page app:

1. Install Dependencies

Make sure you have Python 3.11+ and Streamlit installed. You can install all required packages using:

pip install -r requirements.txt

Or, to install just the healthcheck package:

pip install streamlit_healthcheck

2. Configure Health Checks

Edit config/health_check_config.json to customize system thresholds, endpoints, and custom checks. Example config:

{
  "system": { "cpu": 80, "memory": 75 },
  "dependencies": ["https://api.example.com", "postgresql://..."],
  "custom_checks": ["my_custom_check"]
}

3. Run the Streamlit Dashboard

Launch the main dashboard app:

streamlit run status_page/Home.py

This will open the healthcheck dashboard in your browser. Use the sidebar to navigate between system, dependency, and custom check tabs.

4. Add More Pages (Optional)

You can extend the dashboard by adding new pages to the status_page/pages/ directory. Each .py file will appear as a tab in the Streamlit app.

5. Troubleshooting

If you encounter issues:

  • Ensure your config file is valid JSON
  • Check that all dependencies are reachable
  • Review error messages in the dashboard tabs

Also follow the atatched how to guide


Features

Feature Description
System Health Monitors CPU, memory, disk usage with warning/critical thresholds
Dependency Checks Verifies API endpoints and database connections
Custom Checks Register custom health checks for your app logic
Page Error Tracking Captures exceptions and Streamlit errors per page
Live Dashboard Interactive UI with tabs and status indicators
Configurable JSON-based config for checks and thresholds

Configuration

All health check settings are managed via config/health_check_config.json. You can customize:

  • Check intervals
  • System resource thresholds
  • API endpoints and database connections
  • Custom checks
  • Supports environment variables and optional YAML/JSON config for check registration.
  • Default timeouts and thresholds are overridable per-check.

[!TIP] Use the dashboard's configuration expander to adjust thresholds and save changes on the fly.


Project Structure

src/streamlit_healthcheck/      # Core healthcheck logic
status_page/                   # Streamlit UI pages
config/health_check_config.json # Health check configuration
requirements.txt               # Python dependencies
Makefile                       # Build and test commands
tests/                         # Unit tests

The project structure and control flow looks like below

Project Control Flow

  [System Metrics]    [Dependency Probes]    [Custom Checks]
         |                   |                      |
         +--------+----------+----------+-----------+
                  |                     |
               Collector (polls / hooks / events)
                          |
                      Checker Engine
                 (thresholds, retries, caching)
                          |
                      Aggregator
                (status rollup + history store)
                          |
                   Streamlit Dashboard
               (status panels, graphs, runbooks)
                          |
              Alerts / Notifications / Webhooks

HealthCheck Architecture

Figure: high-level architecture and control flow (image from assets/).


Key features

  • Run synchronous or async health checks with timeouts and recovery hints
  • Register custom checks (liveness, readiness, dependency checks)
  • Expose HTTP/Streamlit endpoints for machine-readable and human-readable status
  • Emit structured metrics/events suitable for scraping or CI validation
  • Simple integration helpers for common backends (Redis, Postgres, external APIs)

Quickstart


  1. Install:
pip install streamlit_healthcheck
  1. Basic usage:
from streamlit_healthcheck import healthcheck
report = healthcheck.run_all(timeout=5)
if not report:
   # handle degraded state (log, alert, fail pipeline)
   print(report.summary)

API (common surface)

  • healthcheck.run_all(timeout: float = 5) -> HealthReport Runs all registered checks and returns a HealthReport object with:

    • ok: bool
    • summary: str
    • details: dict
    • duration: float
  • healthcheck.register(name: str, fn: Callable, *, critical: bool = False) Register a custom check function. Critical checks mark the whole service unhealthy.

  • healthcheck.serve(endpoint: str = "/health", host: str = "0.0.0.0", port: int = 8000) Expose a simple HTTP endpoint (or embed in Streamlit) that returns JSON health status.

DevOps alignment

  • Reliable: Designed to reduce deployment failures and improve service uptime.
  • Automatable: Designed to be executed in CI/CD pipelines (pre-deploy checks, post-deploy smoke tests).
  • Observable: Emits structured outputs and metrics for dashboards and alerting.
  • Lean: Small, focused checks to enable frequent, low-risk deployments.
  • Measurable: Integrates with monitoring to improve MTTR and change failure rate.
  • Shareable: Clear APIs, runbooks examples, and integration docs for teams.

Integration tips

  • Use canary deployments or blue-green deployments to minimize impact during rollouts.
  • Use feature flags or conditional checks to avoid noisy alerts during rollouts.
  • Run healthcheck.run_all in CI as a gating step for deployments.
  • Expose metrics to Prometheus or your metrics backend for SLA tracking.

Contributing

  • Tests, type hints, and small, focused PRs welcome.
  • Follow the repository's CONTRIBUTING.md and code-of-conduct.
  • Add unit tests for new checks and integrations; CI runs linting and tests.
  • Use GitHub issues for bugs, feature requests, and discussions.

Each push on main with create a tag and publish to PyPI.

License

GNU GENERAL PUBLIC LICENSE v3

Troubleshooting

[!WARNING] If the dashboard reports a "critical" status, check the error details in the relevant tab. For API/database issues, verify connectivity and credentials. For system resource alerts, consider scaling your infrastructure.


Getting Help


Release files for streamlit-healthcheck 0.1.9

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

Source distribution (sdist)

Source distribution for streamlit-healthcheck 0.1.9
File Size Uploaded
streamlit_healthcheck-0.1.9.tar.gz 387.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-healthcheck 0.1.9
File Interpreter ABI Platform
streamlit_healthcheck-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 431.5 kB

Release files / streamlit_healthcheck-0.1.9.tar.gz

Download URL streamlit_healthcheck-0.1.9.tar.gz
Size 387.4 kB
Tags Source
SHA-256 checksum
How to use checksums
15c4edb26c938231bdf9dde79690311bb8437de5ff4a642b65774d6b883b6500
BLAKE2b-256 checksum
How to use checksums
ca665cd5f9554d7a0254af0ca6d520b4936469813e1cb34b423d613e3f8387dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2025.

Transparency log

Release files / streamlit_healthcheck-0.1.9-py3-none-any.whl

Download URL streamlit_healthcheck-0.1.9-py3-none-any.whl
Size 44.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcd820e62851dcf6207ae7b8319424eaab6cb15d7911d3e303eb19d8af75b2c3
BLAKE2b-256 checksum
How to use checksums
1be29c886bb65f6cb7896cec323a264e5b9538702965b76879de7bf9a06071e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.0

2 release files

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