37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
// Package notification owns the fan-out of alert events to operator-
|
|
// configured channels. Three channels in v1: webhook, ntfy, smtp.
|
|
// Each channel implements Channel.Send for one Payload at a time;
|
|
// the Hub orchestrates fan-out, persists to notification_log.
|
|
package notification
|
|
|
|
import "time"
|
|
|
|
// Event identifies the lifecycle hook this notification is for.
|
|
type Event string
|
|
|
|
const (
|
|
// EventRaised occurs when an alert is first raised.
|
|
EventRaised Event = "alert.raised"
|
|
// EventAcknowledged occurs when an alert is acknowledged.
|
|
EventAcknowledged Event = "alert.acknowledged"
|
|
// EventResolved occurs when an alert is resolved.
|
|
EventResolved Event = "alert.resolved"
|
|
// EventTest is used for test notifications.
|
|
EventTest Event = "alert.test"
|
|
)
|
|
|
|
// Payload is the per-event blob every channel renders into its own
|
|
// shape. Severity maps to channel-specific priority (ntfy) or stays
|
|
// in the body (webhook/smtp).
|
|
type Payload struct {
|
|
Event Event // alert.raised | … | alert.test
|
|
AlertID string // ULID
|
|
Severity string // info | warning | critical
|
|
Kind string // backup_failed | …
|
|
HostID string
|
|
HostName string
|
|
Message string
|
|
RaisedAt time.Time
|
|
Link string // Absolute URL to /alerts/<id>; built by Hub
|
|
}
|