Source: factory.core/ObjAlert.py
Tracks alert check performance metrics across all check runs.
Provides real-time visibility into alert system performance, trigger rates,
and overall health. Metrics are shared across all alert instances.
| Method | Signature | Description |
|---|---|---|
| record_check | record_check(alerts_checked: int, alerts_triggered: int, elapsed: float, success: bool = True) |
Record metrics from a completed check run. |
| get_stats | get_stats() -> dict |
Get current performance statistics. |
| format_stats | format_stats() -> str |
Return formatted performance statistics as a string. |
| print_stats | print_stats() -> None |
Print formatted statistics (calls format_stats). |
| Method | Signature | Description |
|---|---|---|
| patch_param | patch_param(text: str) -> str |
|
| process_text | process_text(text: str) -> str |
|
| alert_track | alert_track(alert: str, package: str, alert_note: str, value_check: str = '', severity: str = 'MEDIUM', notify_mode: AlertNotifyMode = AlertNotifyMode.LOCAL) -> None |
|
| check | check(package: str = '', archetype: str = '', remote_check: bool = False, notify_mode: AlertNotifyMode = AlertNotifyMode.LOCAL) -> None |
|
| import_remote | import_remote() -> None |
|
| check_remote | check_remote() -> None |
|
| Service | Service() -> None |
|
| write_metrics_to_db | write_metrics_to_db(package: str, check_guid: str, check_server: str, alerts_checked: int, alerts_triggered: int, alerts_passed: int, elapsed_seconds: float, avg_trigger_sql_time: float | None, max_trigger_sql_time: float | None, memory_usage_mb: float | None, success: bool, triggered_alerts: list | None = None, remote_check: bool = False, error_message: str | None = None) -> None |
Persists alert check metrics to def_alert_metric table. |
| cleanup_old_metrics | cleanup_old_metrics(days_to_keep: int = 90, batch_size: int = 10000) -> dict |
Remove metrics older than specified days. |
| detect_anomalies | detect_anomalies(package: str | None = None, sensitivity: str = 'medium', days_baseline: int = 30) -> list |
Detect performance anomalies using statistical analysis. |
| is_maintenance_window | is_maintenance_window(alert: str, package: str) -> bool |
Check if alert is in maintenance window. |
| should_suppress_alert | should_suppress_alert(alert: str, package: str) -> bool |
Check if alert should be suppressed due to parent alert firing. |
| should_throttle_alert | should_throttle_alert(alert: str, package: str, alert_obj) -> tuple |
Check if alert should be throttled based on rate limiting. |
| trigger_alert_storm_warning | trigger_alert_storm_warning(alert: str, package: str, trigger_count: int) |
Trigger warning that alert is firing too frequently. |
| acknowledge_alert | acknowledge_alert(alert_guid: str, user: str, notes: str | None = None, person_guid: str | None = None) -> bool |
Acknowledge an alert to stop escalation. |
| resolve_alert | resolve_alert(alert_guid: str, user: str, notes: str | None = None, person_guid: str | None = None) -> bool |
Mark alert as resolved. |
| check_escalations | check_escalations() -> None |
Check for unacknowledged alerts that need escalation. |
| escalate_alert | escalate_alert(guid: str, alert: str, package: str, level: int, targets: str, severity: str) |
Escalate an alert to next level. |
| check_recoveries | check_recoveries() -> None |
Detect and notify when alerts recover (stop firing). |
| send_recovery_notification | send_recovery_notification(alert: str, package: str, resolved_by: str) |
Send notification that alert has recovered. |
| check_predictive_alerts | check_predictive_alerts() -> None |
Use anomaly detection to trigger predictive alerts. |
| enrich_alert_context | enrich_alert_context(alert: str, package: str) -> dict |
Add context to alert for better troubleshooting. |
| get_runbook_path | get_runbook_path(alert: str, package: str | None = None) -> str | None |
Resolve runbook file path for an alert. |
| load_runbook_content | load_runbook_content(alert: str, package: str | None = None) -> dict |
Load runbook content for an alert. |
| generate_runbook_stub | generate_runbook_stub(alert: str, package: str | None = None, force: bool = False) -> str | None |
Generate a runbook stub from template for an alert. |
| get_alert_state | get_alert_state(package: str | None = None) -> dict |
Return current alert state as JSON for monitoring dashboards. |
| get_alert_dashboard_json | get_alert_dashboard_json(package: str | None = None) -> dict |
Comprehensive dashboard state with trends and SLA metrics. |
| analyze_alert_correlations | analyze_alert_correlations(package: str | None = None, days: int = 7, min_correlation: float = 0.5, time_window_minutes: int = 30) -> list |
Analyze correlations between alerts to find patterns. |
| detect_alert_sequences | detect_alert_sequences(package: str | None = None, days: int = 7, max_delay_minutes: int = 60, min_occurrences: int = 3) -> list |
Detect temporal sequences where one alert consistently |
| suggest_dependencies | suggest_dependencies(package: str | None = None, days: int = 30, min_correlation: float = 0.7, min_occurrences: int = 5) -> list |
Suggest alert dependencies based on correlation and sequence analysis. |
| group_correlated_alerts | group_correlated_alerts(package: str | None = None, days: int = 7, min_correlation: float = 0.6) -> list |
Group alerts into clusters based on correlation patterns. |
| get_correlation_matrix | get_correlation_matrix(package: str | None = None, days: int = 7, time_window_minutes: int = 30) -> dict |
Get correlation matrix showing correlation scores between |
Checks for alerts.
Checks for remote alerts.
Runs the alert service.
Generate a runbook stub for an alert from template.
Generate runbooks for all alerts that don't have one.
Display the runbook content for an alert.
List all available runbooks for a package.