alerts

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package alerts raises ops alerts: things a human must act on. Every alert is emitted as one structured log line, which OpenObserve alert rules match:

level=ERROR msg="ops alert" alert_subject=… alert_message=…

plus whatever the context carries through logging.With (loan_id, loan_reference, trace_id). Delivery to Slack, Telegram and PagerDuty is OpenObserve's job, not the code's.

Index

Constants

View Source
const (
	Message     = "ops alert"
	AttrSubject = "alert_subject"
	AttrMessage = "alert_message"
)

Message and attribute keys OpenObserve alert rules match on. Changing any of them silently breaks alerting.

Variables

This section is empty.

Functions

func Raise

func Raise(ctx context.Context, svc Service, logger *slog.Logger, subject, message string)

Raise sends an alert through svc. A nil svc, or one that fails, falls back to the log line, so an alert is never lost to a delivery problem.

Types

type LogAlerter

type LogAlerter struct {
	Logger *slog.Logger
}

LogAlerter raises an alert as the canonical log line.

func (LogAlerter) AlertOps

func (l LogAlerter) AlertOps(ctx context.Context, subject, message string) error

AlertOps implements Service. It never fails.

type Service

type Service interface {
	AlertOps(ctx context.Context, subject, message string) error
}

Service raises an ops alert. subject is a stable, low-cardinality title that alert rules route on; message carries the specifics.

Jump to

Keyboard shortcuts

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