Expand description
Notifications: per-org channels (webhook, Slack, Discord, Telegram,
email) told about events of chosen kinds (deploy.*, health.*,
backup.*, job.*, cert.*, monitor.*; see
crate::stack::controller::Event).
A dispatcher thread follows the controller’s event feed and queues a delivery per matching channel. Each channel has its own bounded queue and sender thread, so a slow or failing channel never holds up another: a delivery is retried with exponential backoff, a channel is rate limited, and the last deliveries per channel are kept with their outcome.
The feed lives in memory and starts at 1 with each daemon run, so the dispatcher starts from the beginning of the run: nothing from before a restart is sent again (and deliveries still queued at a restart are lost).
Channels and delivery logs are kept under <state>/orgs/<org>/notify/.
Destinations are held to net’s address policy.
Re-exports§
Modules§
- net
- Outbound connections held to an address policy (notifications, and whatever else dials an address an org member chose).
- provider
- What each kind of channel sends: the HTTP request (or mail) for one message, built from the channel’s settings and its secrets’ values.
- smtp
- A minimal SMTP submission client: one message, plain text, over STARTTLS or implicit TLS (rustls, the same stack as the rest of isb), AUTH PLAIN or LOGIN. Enough for notifications; not a mail library.
Structs§
- Channel
- A notification channel of an org.
- Delivery
- One delivery to one channel, as its log shows it.
- Notifier
- The notification service of a daemon.
- Rate
Limit - Sliding one-minute window of sends.
- Rule
- Which events a channel hears about. An event matches a rule when its kind
matches one of
events(globs:deploy.*,*.failed,*) and it passes every non-empty filter. - Settings
- Server-wide settings (platform admins).
- Subject
- What a rule is matched against.
Constants§
- ATTEMPTS
- Attempts per delivery, the first included.
- BACKOFF_
MAX - The longest wait between attempts (Retry-After included).
- LOG_
KEPT - Deliveries kept in a channel’s log.
- PER_
MINUTE - Messages a channel sends per minute at most.
- QUEUE_
MAX - Deliveries waiting per channel; the oldest is dropped past this.
Functions§
- backoff
- The wait before attempt
attempt + 1(attempt counts from 1): the base doubling per attempt, at least what the server asked for, capped. - event_
org - The org of an event and its stack’s own name. Events name their stack
org/stack, or juststackin the default org. - glob
*matches any run of characters, everything else itself.- validate_
name - A channel name: [a-z0-9-], starts with a letter, at most 40.
Type Aliases§
- Details
- Structured details of an event, from its producer (a monitor’s URL,
status and latency), for
Message::details. - Resolve
- The app project a service belongs to:
(org, stack, service).