spec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertConfig

type AlertConfig struct {
	// Name is the name of the alert (optional).
	Name string `yaml:"name"`
	// BurnRate specifies the alert as error budget burn rate alert.
	BurnRate *BurnRateAlertConfig `yaml:"burnRate"`
	// BurnRate specifies the alert as error budget consumption alert.
	ErrorBudget *ErrorBudgetAlertConfig `yaml:"errorBudget"`
	// Alerter specifies how alerting is implemented for this alert.
	Alerter AlerterConfig
}

AlertConfig is a configuration for SLO alerts. Either the BurnRate or ErrorBudget field must be specified.

type AlerterConfig

type AlerterConfig struct {
	// Prometheus specifies that the alert is implemented with Prometheus.
	Prometheus *PrometheusAlerterConfig `yaml:"prometheus,omitempty"`
}

AlerterConfig is a configuration for alert implementation.

type BurnRateAlertConfig

type BurnRateAlertConfig struct {
	// ConsumedBudgetRatio is the alerting threshold based on the ratio of the consumed error budget (0.0 - 1.0).
	ConsumedBudgetRatio float64 `yaml:"consumedBudgetRatio"`

	// SingleWindow specifies that the SLO burn rate alert is implemented as a single window alert.
	SingleWindow *SingleWindowBurnRateAlertConfig `yaml:"singleWindow"`

	// MultiWindows specifies that the SLO burn rate alert is implemented as a [multiwindow] alert.
	//
	// [multiwindow]: https://sre.google/workbook/alerting-on-slos/#6-multiwindow-multi-burn-rate-alerts
	MultiWindows *MultiWindowsBurnRateAlertConfig `yaml:"multiWindows"`
}

BurnRateAlertConfig is a configuration for an SLO burn rate alert.

type CalendarWindowConfig

type CalendarWindowConfig struct {
	// Duration is the size of the window in [time.Duration] format.
	Duration string `yaml:"duration"`
	// Start is the starting point of the calendar windows.
	Start string `yaml:"start"`
}

CalendarWindowConfig is a configuration for an SLO calendar window.

type ErrorBudgetAlertConfig

type ErrorBudgetAlertConfig struct {
	// ConsumedBudgetRatio is the alerting threshold based on the ratio of the consumed error budget (0.0 - 1.0).
	ConsumedBudgetRatio float64 `yaml:"consumedBudgetRatio"`
}

BurnRateAlertConfig is a configuration for an SLO error budget alert.

type IndicatorConfig

type IndicatorConfig struct {
	// Prometheus is an SLI implemented with Prometheus.
	Prometheus *PrometheusIndicatorConfig `yaml:"prometheus,omitempty"`
}

IndicatorConfig is a configuration for a service level indicator (SLI).

type MultiWindowsBurnRateAlertConfig

type MultiWindowsBurnRateAlertConfig struct {
	// ShortWindowRef is the window name that refers to a window defined in SpecConfig.Windows.
	// The short window is a secondary window used to shorten the alert reset time.
	ShortWindowRef string `yaml:"shortWindowRef"`

	// LongWindowRef is the window name that refers to a window defined in SpecConfig.Windows.
	// The long window is a primary window.
	LongWindowRef string `yaml:"longWindowRef"`
}

MultiWindowsBurnRateAlertConfig is a configuration for an SLO burn rate alert implemented as a multiwindow alert.

type ObjectiveConfig

type ObjectiveConfig struct {
	// Ratio is the target ratio of the SLO.
	Ratio float64 `yaml:"ratio"`
	// WindowRef is the window name that refers to a window defined in SLOConfig.Windows.
	WindowRef string `yaml:"windowRef"`
}

ObjectiveConfig is a configuration for an SLO target.

type PrometheusAlerterConfig

type PrometheusAlerterConfig struct {
	// Name is the name of the Prometheus alert.
	Name string `yaml:"name,omitempty"`
	// Labels are the labels attached to Prometheus alerts.
	Labels map[string]string `yaml:"labels,omitempty"`
	// Annotations are the annotations attached to Prometheus alerts.
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

type PrometheusIndicatorConfig

type PrometheusIndicatorConfig struct {
	// ErrorRatio is a PromQL query that computes the error ratio (0 - 1) of a service.
	ErrorRatio string `yaml:"errorRatio"`
	// Level is the list of Prometheus labels that represent the recording [aggregation level] of the query and appear in the query results.
	//
	// [aggregation level]: https://prometheus.io/docs/practices/rules/#naming
	Level []string `yaml:"level,omitempty"`
}

PrometheusIndicatorConfig is a configuration for an SLI implemented with Prometheus.

type PrometheusWindowConfig

type PrometheusWindowConfig struct {
	// EvaluationInterval represents how often rules associated with this window are evaluated.
	EvaluationInterval string `yaml:"evaluation_interval"`
}

type RollingWindowConfig

type RollingWindowConfig struct {
	// Duration is the size of the window in [time.Duration] format.
	Duration string `yaml:"duration"`
}

RollingWindowConfig is a configuration for an SLO rolling window.

type SLOConfig

type SLOConfig struct {
	// Name is the name of the SLO.
	Name string `yaml:"name"`
	// Labels are the labels of the SLO.
	Labels map[string]string `yaml:"labels"`
	// Annotations are the annotations of the SLO.
	Annotations map[string]string `yaml:"annotations"`
	// Objective is the target of the SLO.
	Objective ObjectiveConfig `yaml:"objective"`
	// Indicator is the SLI for the SLO.
	Indicator IndicatorConfig `yaml:"indicator"`
	// Alerts are alert configurations for the SLO.
	Alerts []AlertConfig `yaml:"alerts,omitempty"`
	// Windows are windows used by the SLI and SLO.
	Windows []WindowConfig `yaml:"windows,omitempty"`
}

SLOConfig is a configuration for SLO.

type SingleWindowBurnRateAlertConfig

type SingleWindowBurnRateAlertConfig struct {
	// WindowRef is the window name that refers to a window defined in SpecConfig.Windows.
	WindowRef string `yaml:"windowRef"`
}

type SpecConfig

type SpecConfig struct {
	// Name is the name of the SLO specification.
	Name string `yaml:"name"`
	// Labels are the labels of the SLO specification.
	Labels map[string]string `yaml:"labels"`
	// Annotations are the annotations of the SLO specification.
	Annotations map[string]string `yaml:"annotations"`
	// SLOs are SLO configurations.
	SLOs []SLOConfig `yaml:"slos,omitempty"`
}

SpecConfig is a configuration for an SLO specification. An SLO specification typically corresponds to a specific service or user journey and may include multiple SLO entries.

func ParseSpecConfig

func ParseSpecConfig(r io.Reader) (*SpecConfig, error)

type WindowConfig

type WindowConfig struct {
	// Name is the name of the window.
	Name string `yaml:"name"`
	// Rolling specifies the window as a rolling window.
	Rolling *RollingWindowConfig `yaml:"rolling,omitempty"`
	// Calendar specifies the window as a calendar window.
	Calendar *CalendarWindowConfig `yaml:"calendar,omitempty"`
	// Prometheus specifies the evaluation configuration of the window.
	Prometheus *PrometheusWindowConfig `yaml:"prometheus,omitempty"`
}

WindowConfig is a configuration for a window used by SLIs and SLOs. Either the Rolling or Calendar field must be specified.

Jump to

Keyboard shortcuts

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