Documentation
¶
Index ¶
- Constants
- type AlertSeverity
- type Info
- type K8sMeta
- type MWMBAlert
- type MWMBAlertGroup
- type Mode
- type PromAlertMeta
- type PromRuleGroup
- type PromSLI
- type PromSLIEvents
- type PromSLIRaw
- type PromSLO
- type PromSLOGroup
- type PromSLOGroupResult
- type PromSLOGroupSource
- type PromSLOPluginMetadata
- type PromSLOResult
- type PromSLORules
- type SLOPlugins
Constants ¶
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 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 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 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 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
}