maple.utils.health

Container health monitoring utilities.

This module provides automatic health monitoring for Docker containers running policy backends and environments. It implements a background thread that periodically checks container health and can automatically restart failed containers.

Key features: - Periodic health checks with configurable intervals - Automatic restart on failure (optional) - Consecutive failure counting before marking unhealthy - Custom health check and restart callbacks - Thread-safe container registration - Real-time status reporting

The HealthMonitor class runs a daemon thread that continuously monitors registered containers and maintains their health status.

Classes

HealthMonitor([check_interval, on_unhealthy])

Thread-safe health monitor for Docker containers.

HealthStatus(*values)

Health status enumeration for monitored containers.

MonitoredContainer(container_id, name, check_fn)

Data class representing a container under health monitoring.