notifyalert

package
v1.147.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package notifyalert sends the platform's own alerts -- a review queue past its threshold, a connection whose credential was revoked, a scheduled run that failed -- to the notification channels an operator named for each, beside the email recipients those alerts already reach (#1724).

An alert sent to a channel is authorized as the platform. The operator who named the channel in the alert's settings is the authorization, as naming a recipient is: no persona is consulted, and the send is charged to no actor. Each alert passes its own key, so the channel's repeat window applies to an alert that keeps firing.

Index

Constants

View Source
const MaxChannels = 10

MaxChannels bounds the channels one alert names, as notification.MaxChannelRecipients bounds an email list.

Variables

View Source
var ErrUnknownChannel = errors.New("no notification channel has that name")

ErrUnknownChannel is wrapped by Validate for a name no channel is stored under.

Functions

func Normalize

func Normalize(names []string) []string

Normalize trims a submitted channel list, dropping blanks and repeats, so a form's empty last line or a doubled entry is not stored.

func Validate

func Validate(ctx context.Context, store notification.ChannelStore, names []string) error

Validate refuses a channel list an alert cannot send to: too many entries, or a name no channel is stored under. A channel that exists but is disabled is accepted, as it is everywhere else an operator names one: enabling it later should not mean re-entering it here.

Types

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender sends an alert to channels. A nil Sender sends nothing, which is how a deployment with no channels is wired.

func New

func New(channels notification.ChannelStore, enqueuer *notification.Enqueuer) *Sender

New builds a Sender, or nil when either dependency is absent.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, names []string, key string, p notification.Payload) int

Send queues the alert's payload for each named channel under key and returns how many channels it was queued for. A channel that is gone, disabled, over its cap or failing is logged and the rest still go out: one bad entry must not silence the alert for every other channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL