CodeNameRaven.Channel.Notification (raven_observer_sdk v0.6.0)

Copy Markdown

The payload delivered to a channel when an alert fires.

Produced by the Handler when a monitor's status changes to a condition that matches a configured alert rule. Passed to Channel.deliver/2.

Never crosses node or version boundaries — created and consumed within a single handler process — so it carries no vsn/upcast machinery.

Summary

Functions

Seconds between alert_started_at and occurred_at, or nil when the alert's start is unknown. Shared by channel formatters so "was down N minutes" is computed one way everywhere.

Human-readable duration-down ("14m", "3h 12m", "2d 5h"), or nil when the alert's start is unknown. Sub-minute durations render as "<1m".

Types

status()

@type status() :: :up | :degraded | :down | :unknown

t()

@type t() :: %CodeNameRaven.Channel.Notification{
  alert_started_at: DateTime.t() | nil,
  instance_id: String.t() | nil,
  monitor_id: String.t(),
  monitor_name: String.t() | nil,
  node: node() | nil,
  occurred_at: DateTime.t(),
  previous_status: status() | nil,
  status: status()
}

Functions

duration_down(notification)

@spec duration_down(t()) :: non_neg_integer() | nil

Seconds between alert_started_at and occurred_at, or nil when the alert's start is unknown. Shared by channel formatters so "was down N minutes" is computed one way everywhere.

format_duration_down(n)

@spec format_duration_down(t()) :: String.t() | nil

Human-readable duration-down ("14m", "3h 12m", "2d 5h"), or nil when the alert's start is unknown. Sub-minute durations render as "<1m".