digest

package
v0.9.5 Latest Latest
Warning

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

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

Documentation

Overview

Package digest builds a per-project weekly summary of deploys, failures, fired alerts and backup status and sends it through notification channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(s Stats, since, until time.Time) string

Format renders one project's digest as short plain text.

Types

type Runner

type Runner struct {
	Source   Source
	Sender   Sender
	Logger   *slog.Logger
	Now      func() time.Time
	Enabled  func() bool
	Interval func() time.Duration
}

Runner sends one digest per active project. Interval and enablement are read per tick through the getters so runtime settings apply live.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run ticks until ctx ends, calling RunOnce each interval.

func (*Runner) RunOnce

func (r *Runner) RunOnce(ctx context.Context) (int, error)

RunOnce sends digests for the window ending now. It returns how many notices went out; a failing channel is logged and does not stop the rest.

type Sender

type Sender interface {
	SendNotice(ctx context.Context, channelID, text string) error
}

Sender delivers one text notice to a channel id.

type Source

type Source interface {
	ProjectStats(ctx context.Context, since, until time.Time) ([]Stats, error)
	ChannelsFor(ctx context.Context, project string) ([]string, error)
}

Source supplies the window stats and the channels a project digest goes to.

type Stats

type Stats struct {
	Project       string
	Deploys       int
	Failures      int
	AlertsFired   int
	BackupsOK     int
	BackupsFailed int
}

Stats is what one project did inside the digest window.

func (Stats) Quiet

func (s Stats) Quiet() bool

Quiet reports whether there is nothing worth sending for the project.

Jump to

Keyboard shortcuts

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