feat(simple_metrics): model-level, window-aware threshold breach alert (SIENTIAPDE-2189)

This commit is contained in:
PedroHMCosme
2026-10-07 15:18:35 -03:00
parent 196b1aa708
commit 9c89cfbf8e
2 changed files with 13 additions and 5 deletions

View File

@@ -447,14 +447,18 @@ class ModelMetrics(SientiaMonitoring):
breach_msg = f'{metric_name}={value} below {min_key}={thresholds[min_key]}'
if breach_msg:
self.warning(
f'Threshold breach for model {model_id}: {breach_msg}',
metadata,
message = (
f'Threshold breach for model {model_id} '
f'(window {interval_minutes} min): {breach_msg}'
)
self.warning(message, metadata)
self.send_notification(
metadata=metadata,
# Model-level trigger: the orchestrator dedups alerts on
# `<trigger>:<notification_id>`, so one breach seen by several windows
# (one schedule each) becomes one alert (SIENTIAPDE-1995).
metadata={**metadata, 'schedule_name': f'{model_id}-simple_metrics'},
notification_id='SIMPLE_METRICS_THRESHOLD_BREACH',
message=f'Threshold breach for model {model_id}: {breach_msg}',
message=message,
block='model_metrics',
level=NotificationLevel.WARNING,
)