Alert
- class applications.healthcheck.core.alerts.Alert(*, level: ~applications.healthcheck.models.choices.AlertLevel, title: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1), ~annotated_types.MaxLen(max_length=512)], description: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)], reason: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)], metadata: dict[str, ~typing.Any] = <factory>)
Bases:
BaseModelImmutable alert produced by a rule evaluation.
Alerts represent specific issues or conditions detected by a healthcheck rule. They are frozen to ensure historical integrity - once created, an alert cannot be modified.
- level
Severity level (OK, LOW, MEDIUM, HIGH, CRITICAL).
- title
Short summary for display in lists and notifications (max 512 chars).
- Type:
str
- description
Detailed explanation of what was detected.
- Type:
str
- reason
Why this alert was triggered (threshold exceeded, etc.).
- Type:
str
- metadata
Structured data for debugging and downstream processing.
- Type:
dict[str, Any]
Example
>>> Alert( ... level=AlertLevel.HIGH, ... title="High job failure rate detected", ... description="25% of jobs failed in the last 24 hours (75/300 jobs)", ... reason="Failure rate 0.25 exceeds threshold 0.10", ... metadata={ ... "failure_rate": 0.25, ... "threshold": 0.10, ... "failed_jobs": 75, ... "total_jobs": 300, ... } ... )
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].