pharos/alert

Types

Configuration for a single alert rule gen_statem instance. Pass to alert_manager.start_link/2.

pub type AlertData {
  AlertData(
    id: String,
    level: AlertLevel,
    soak_period_ms: Int,
    cool_period_ms: Int,
  )
}

Constructors

  • AlertData(
      id: String,
      level: AlertLevel,
      soak_period_ms: Int,
      cool_period_ms: Int,
    )

    Arguments

    id

    Unique string ID for this alert rule (e.g. "total_memory").

    level

    Severity level carried in AlertFiring events.

    soak_period_ms

    Milliseconds the threshold must stay breached before the alert fires. Set to 0 to skip the Pending state and fire immediately.

    cool_period_ms

    Milliseconds recovery must hold before the alert resolves.

Events broadcast over the gen_event alert dispatcher bus.

pub type AlertEvent {
  AlertFiring(id: String, level: AlertLevel, diagnostic: String)
  AlertResolved(id: String)
}

Constructors

  • AlertFiring(id: String, level: AlertLevel, diagnostic: String)

    Threshold has been continuously breached for longer than soak_period_ms. diagnostic is a snapshot of VM state captured at the moment the soak timer fires.

  • AlertResolved(id: String)

    System recovered and stayed healthy for at least cool_period_ms.

Alert severity level attached to a firing alert.

pub type AlertLevel {
  Warning
  Critical
}

Constructors

  • Warning
  • Critical

The four states of the alert lifecycle state machine.

pub type AlertState {
  Clear
  Pending
  Firing
  Cooling
}

Constructors

  • Clear

    System is healthy; no timer running.

  • Pending

    Threshold just breached; soak timer is counting down.

  • Firing

    Alert is active - threshold was breached for the full soak period.

  • Cooling

    System recovered; cool-down timer is counting down.

Search Document