alert

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSWindowsRepo added in v0.9.0

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

func NewFSWindowsRepo added in v0.9.0

func NewFSWindowsRepo(config FSWindowsRepoConfig) (*FSWindowsRepo, error)

func (*FSWindowsRepo) GetWindows added in v0.9.0

func (f *FSWindowsRepo) GetWindows(ctx context.Context, period time.Duration) (*Windows, error)

type FSWindowsRepoConfig added in v0.9.0

type FSWindowsRepoConfig struct {
	FS     fs.FS
	Logger log.Logger
}

type Generator added in v0.9.0

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

Generator knows how to generate all the required alerts based on an SLO. The generated alerts are generic and don't depend on any specific SLO implementation.

func NewGenerator added in v0.9.0

func NewGenerator(windowsRepo WindowsRepo) Generator

func (Generator) GenerateMWMBAlerts added in v0.9.0

func (g Generator) GenerateMWMBAlerts(ctx context.Context, slo SLO) (*MWMBAlertGroup, error)

type MWMBAlert

type MWMBAlert struct {
	ID             string
	ShortWindow    time.Duration
	LongWindow     time.Duration
	BurnRateFactor float64
	ErrorBudget    float64
	Severity       Severity
}

MWMBAlert represents a multiwindow, multi-burn rate alert.

type MWMBAlertGroup

type MWMBAlertGroup struct {
	PageQuick   MWMBAlert
	PageSlow    MWMBAlert
	TicketQuick MWMBAlert
	TicketSlow  MWMBAlert
}

MWMBAlertGroup what represents all the alerts of an SLO. ITs divided into two groups that are made of 2 alerts: - Page & quick: Critical alerts that trigger in high rate burn in short term. - Page & slow: Critical alerts that trigger in high-normal rate burn in medium term. - Ticket & slow: Warning alerts that trigger in normal rate burn in medium term. - Ticket & slow: Warning alerts that trigger in slow rate burn in long term.

type SLO

type SLO struct {
	ID         string
	TimeWindow time.Duration
	Objective  float64
}

type Severity

type Severity int

Severity is the type of alert.

const (
	UnknownAlertSeverity Severity = iota
	PageAlertSeverity
	TicketAlertSeverity
)

func (Severity) String

func (s Severity) String() string

type Window added in v0.9.0

type Window struct {
	// ErrorBudgetPercent is the error budget % consumed for a full time window.
	// Google gives us some defaults in its SRE workbook that work correctly most of the times:
	// - Page quick:   2%
	// - Page slow:    5%
	// - Ticket quick: 10%
	// - Ticket slow:  10%
	ErrorBudgetPercent float64
	// ShortWindow is the small window used on the alerting part to stop alerting
	// during a long window because we consumed a lot of error budget but the problem
	// is already gone.
	ShortWindow time.Duration
	// LongWindow is the long window used to alert based on the errors happened on that
	// long window.
	LongWindow time.Duration
}

func (Window) Validate added in v0.9.0

func (w Window) Validate() error

type Windows added in v0.9.0

type Windows struct {
	SLOPeriod   time.Duration
	PageQuick   Window
	PageSlow    Window
	TicketQuick Window
	TicketSlow  Window
}

Windows has the information of the windows for multiwindow-multiburn SLO alerting. Its a matrix of values with: - Alert severity: ["page", "ticket"]. - Measuring period: ["long", "short"].

func (Windows) GetSpeedPageQuick added in v0.9.0

func (w Windows) GetSpeedPageQuick() float64

Error budget speeds based on a full time window, however once we have the factor (speed) the value can be used with any time window.

func (Windows) GetSpeedPageSlow added in v0.9.0

func (w Windows) GetSpeedPageSlow() float64

func (Windows) GetSpeedTicketQuick added in v0.9.0

func (w Windows) GetSpeedTicketQuick() float64

func (Windows) GetSpeedTicketSlow added in v0.9.0

func (w Windows) GetSpeedTicketSlow() float64

func (Windows) Validate added in v0.9.0

func (w Windows) Validate() error

type WindowsRepo added in v0.9.0

type WindowsRepo interface {
	GetWindows(ctx context.Context, period time.Duration) (*Windows, error)
}

WindowsRepo knows how to retrieve windows based on the period of time.

Jump to

Keyboard shortcuts

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