alert

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSWindowsRepo

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

func NewFSWindowsRepo

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

func (*FSWindowsRepo) GetWindows

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

type FSWindowsRepoConfig

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

type Generator

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

func NewGenerator(windowsRepo WindowsRepo) Generator

func (Generator) GenerateMWMBAlerts

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

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

func (w Window) Validate() error

type Windows

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

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

func (w Windows) GetSpeedPageSlow() float64

func (Windows) GetSpeedTicketQuick

func (w Windows) GetSpeedTicketQuick() float64

func (Windows) GetSpeedTicketSlow

func (w Windows) GetSpeedTicketSlow() float64

func (Windows) Validate

func (w Windows) Validate() error

type WindowsRepo

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