Help us shape the future of Go! Take the 2026 Go Developer Survey

notify

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package notify is Console's alerting seam. A Notifier delivers a core.Event to an external sink (Slack, a webhook, email); the Dispatcher fans an event out to every registered Notifier. The flag and status engines emit events through a Dispatcher, so monitoring can actually reach a human.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher fans events out to its Notifiers, best-effort: a slow or failing sink is bounded by a timeout and logged, and never fails the operation that produced the event. Its Emit method matches the engines' emitter hook.

func NewDispatcher

func NewDispatcher(notifiers ...Notifier) *Dispatcher

NewDispatcher builds a Dispatcher with the given notifiers.

func (*Dispatcher) Emit

func (d *Dispatcher) Emit(ev core.Event)

Emit delivers ev to every notifier synchronously, bounding each with the dispatcher timeout against a fresh background context (so a notification outlives the request that triggered it). Errors are logged, never returned.

func (*Dispatcher) Len

func (d *Dispatcher) Len() int

Len reports how many notifiers are registered.

func (*Dispatcher) Register

func (d *Dispatcher) Register(n Notifier)

Register adds a notifier.

type Notifier

type Notifier interface {
	// Name identifies the sink, e.g. "slack".
	Name() string
	// Notify delivers ev. A returned error is logged, not propagated to the
	// triggering operation.
	Notify(ctx context.Context, ev core.Event) error
}

Notifier delivers an event to one destination. Implementations should be safe for concurrent use and return promptly; the Dispatcher bounds each call with a timeout but calls them on the path that triggered the event.

Directories

Path Synopsis
Package discord delivers Console events to a Discord channel via a channel Webhook URL.
Package discord delivers Console events to a Discord channel via a channel Webhook URL.
Package email delivers Console events as plain-text email over SMTP.
Package email delivers Console events as plain-text email over SMTP.
Package pagerduty delivers Console events to PagerDuty via the Events API v2 (https://events.pagerduty.com/v2/enqueue).
Package pagerduty delivers Console events to PagerDuty via the Events API v2 (https://events.pagerduty.com/v2/enqueue).
Package slack delivers Console events to a Slack channel via an Incoming Webhook URL.
Package slack delivers Console events to a Slack channel via an Incoming Webhook URL.
Package webhook delivers Console events to an arbitrary HTTP endpoint as a JSON POST.
Package webhook delivers Console events to an arbitrary HTTP endpoint as a JSON POST.

Jump to

Keyboard shortcuts

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