maple.utils.health.MonitoredContainer

class maple.utils.health.MonitoredContainer(container_id: str, name: str, check_fn: Callable[[], bool], restart_fn: Callable[[], None] | None = None, auto_restart: bool = False, max_failures: int = 3, status: HealthStatus = HealthStatus.UNKNOWN, consecutive_failures: int = 0, last_check: float = 0, last_healthy: float = 0, total_restarts: int = 0)

Data class representing a container under health monitoring.

Stores configuration and runtime state for a monitored container, including health check callbacks, restart configuration, and failure tracking.

Methods

__init__(container_id, name, check_fn[, ...])

to_dict()

Convert container state to dictionary format.

Attributes

auto_restart

consecutive_failures

last_check

last_healthy

max_failures

restart_fn

status

total_restarts

container_id

name

check_fn