model

package
v0.16.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ModeTest                    = "test"
	ModeCLIGenPrometheus        = "cli-gen-prom"
	ModeAPIGenPrometheus        = "api-gen-prom"
	ModeCLIGenKubernetes        = "cli-gen-k8s"
	ModeAPIGenKubernetes        = "api-gen-k8s"
	ModeControllerGenKubernetes = "ctrl-gen-k8s"
	ModeCLIGenOpenSLO           = "cli-gen-openslo"
	ModeAPIGenOpenSLO           = "api-gen-openslo"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertSeverity

type AlertSeverity int

AlertSeverity is the type of alert.

const (
	UnknownAlertSeverity AlertSeverity = iota
	PageAlertSeverity
	TicketAlertSeverity
)

func (AlertSeverity) String

func (s AlertSeverity) String() string

type Info

type Info struct {
	Version string
	Mode    Mode
	Spec    string
}

Info is the information of the app and request based for SLO generators.

type K8sMeta added in v0.15.0

type K8sMeta struct {
	Name        string
	Namespace   string
	Annotations map[string]string
	Labels      map[string]string
}

K8sMeta is the Kubernetes simplified metadata used on different parts of Sloth logic like K8s storage.

type MWMBAlert

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

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.

func (MWMBAlertGroup) TimeDurationWindows added in v0.14.0

func (m MWMBAlertGroup) TimeDurationWindows() []time.Duration

TimeDurationWindows is a helper method to get the list of unique and sorted time durations windows of the alert group.

type Mode

type Mode string

type PromAlertMeta

type PromAlertMeta struct {
	Disable     bool
	Name        string
	Labels      map[string]string
	Annotations map[string]string
}

AlertMeta is the metadata of an alert settings.

type PromRuleGroup

type PromRuleGroup struct {
	// Name is the name of the rule group. If empty, a default name will be generated.
	Name     string
	Interval time.Duration
	Rules    []rulefmt.Rule
}

PromRuleGroup are regular prometheus group of rules.

type PromSLI

type PromSLI struct {
	Raw    *PromSLIRaw
	Events *PromSLIEvents
}

SLI represents an SLI with custom error and total expressions.

type PromSLIEvents

type PromSLIEvents struct {
	ErrorQuery string
	TotalQuery string
}

type PromSLIRaw

type PromSLIRaw struct {
	ErrorRatioQuery string
}

type PromSLO

type PromSLO struct {
	ID              string
	Name            string
	Description     string
	Service         string
	SLI             PromSLI
	TimeWindow      time.Duration
	Objective       float64
	Labels          map[string]string
	PageAlertMeta   PromAlertMeta
	TicketAlertMeta PromAlertMeta
	Plugins         SLOPlugins
}

PromSLO represents a service level objective configuration.

type PromSLOGroup

type PromSLOGroup struct {
	SLOs           []PromSLO
	OriginalSource PromSLOGroupSource
}

type PromSLOGroupResult added in v0.15.0

type PromSLOGroupResult struct {
	OriginalSource PromSLOGroupSource
	SLOResults     []PromSLOResult
}

PromSLOGroupResult is the result of generating standard Prometheus SLO rules from SLO definitions as SLO group.

type PromSLOGroupSource

type PromSLOGroupSource struct {
	K8sSlothV1     *k8sprometheusv1.PrometheusServiceLevel
	SlothV1        *prometheusv1.Spec
	OpenSLOV1Alpha *openslov1alpha.SLO
}

Used to store the original source of the SLO group in case we need to make low-level decision based on where the SLOs came from.

type PromSLOPluginMetadata

type PromSLOPluginMetadata struct {
	ID       string
	Config   any
	Priority int
}

type PromSLOResult added in v0.15.0

type PromSLOResult struct {
	SLO             PromSLO
	PrometheusRules PromSLORules
}

PromSLOResult is the result of generating standard Prometheus SLO rules from SLO definitions.

type PromSLORules

type PromSLORules struct {
	// SLIErrorRecRules are the rules for the SLI error recording rules.
	SLIErrorRecRules PromRuleGroup
	// MetadataRecRules are the rules for the metadata recording rules.
	MetadataRecRules PromRuleGroup
	// AlertRules are the rules for the SLO alerting rules.
	AlertRules PromRuleGroup
	// ExtraRules are the extra rules for the SLO, normally used for custom use cases required by the SLO plugins.
	ExtraRules []PromRuleGroup
}

PromSLORules are the prometheus rules required by an SLO.

type SLOPlugins

type SLOPlugins struct {
	OverridePlugins bool // If true, the default, app and other declared plugins at other levels will be overridden by the ones declared in this struct.
	Plugins         []PromSLOPluginMetadata
}

Jump to

Keyboard shortcuts

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