internal_alerts module

Internal alerts system for CodeBot (post-MVP).

  • Stores recent alerts in-memory for ChatOps consumption

  • Emits structured events via observability.emit_event

  • Optionally forwards alerts to sinks via alert_forwarder (Slack/Telegram) or directly to Telegram if alert_forwarder is unavailable.

Environment variables used by the Telegram fallback: - ALERT_TELEGRAM_BOT_TOKEN - ALERT_TELEGRAM_CHAT_ID

This module is intentionally lightweight and fail-open. It should never raise.

internal_alerts.emit_event(event, severity='info', **fields)[מקור]
פרמטרים:
internal_alerts.emit_internal_alert(name, severity='info', summary='', **details)[מקור]

Emit an internal alert: store in-memory, forward to sinks, and log.

severity: ”info“ | ”warn“ | ”error“ | ”critical“ | ”anomaly“

Return type:

None

פרמטרים:
internal_alerts.get_recent_alerts(limit=5)[מקור]
Return type:

List[Dict[str, Any]]

פרמטרים:

limit (int)