Documentation
¶
Index ¶
Constants ¶
const MetadataRecordingRulesGenerator = metadataRecordingRulesGenerator(false)
MetadataRecordingRulesGenerator knows how to generate the metadata prometheus recording rules from an SLO.
const YAMLSpecLoader = yamlSpecLoader(false)
YAMLSpecLoader knows how to load YAML specs and converts them to a model.
Variables ¶
var ( // ErrNoSLORules will be used when there are no rules to store. The upper layer // could ignore or handle the error in cases where there wasn't an output. ErrNoSLORules = fmt.Errorf("0 SLO Prometheus rules generated") )
var SLIRecordingRulesGenerator = sliRecordingRulesGenerator{/* contains filtered or unexported fields */}
SLIRecordingRulesGenerator knows how to generate the SLI prometheus recording rules form an SLO. Normally these rules are used by the SLO alerts.
var SLOAlertRulesGenerator = sloAlertRulesGenerator{/* contains filtered or unexported fields */}
SLOAlertRulesGenerator knows how to generate the SLO prometheus alert rules from an SLO.
Functions ¶
This section is empty.
Types ¶
type AlertMeta ¶
type AlertMeta struct {
Disable bool
Name string `validate:"required_if_enabled"`
Labels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"`
Annotations map[string]string `validate:"dive,keys,prom_annot_key,endkeys,required"`
}
AlertMeta is the metadata of an alert settings.
type IOWriterGroupedRulesYAMLRepo ¶
type IOWriterGroupedRulesYAMLRepo struct {
// contains filtered or unexported fields
}
IOWriterGroupedRulesYAMLRepo knows to store all the SLO rules (recordings and alerts) grouped in an IOWriter in YAML format, that is compatible with Prometheus.
func NewIOWriterGroupedRulesYAMLRepo ¶
func NewIOWriterGroupedRulesYAMLRepo(writer io.Writer, logger log.Logger) IOWriterGroupedRulesYAMLRepo
func (IOWriterGroupedRulesYAMLRepo) StoreSLOs ¶
func (i IOWriterGroupedRulesYAMLRepo) StoreSLOs(ctx context.Context, slos []StorageSLO) error
StoreSLOs will store the recording and alert prometheus rules, if grouped is false it will split and store as 2 different groups the alerts and the recordings, if true it will be save as a single group.
type SLIRaw ¶
type SLIRaw struct {
ErrorRatioQuery string `validate:"required,prom_expr,template_vars"`
}
type SLO ¶
type SLO struct {
ID string `validate:"required,name"`
Name string `validate:"required,name"`
Description string
Service string `validate:"required,name"`
SLI SLI `validate:"required"`
TimeWindow time.Duration
Objective float64 `validate:"gt=0,lte=100"`
Labels map[string]string `validate:"dive,keys,prom_label_key,endkeys,required,prom_label_value"`
PageAlertMeta AlertMeta
WarningAlertMeta AlertMeta
}
SLO represents a service level objective configuration.
func (SLO) GetSLIErrorMetric ¶
GetSLIErrorMetric returns the SLI error metric.
func (SLO) GetSLOIDPromLabels ¶
GetSLOIDPromLabels returns the ID labels of an SLO, these can be used to identify an SLO recorded metrics and alerts.
type SLORules ¶
type SLORules struct {
SLIErrorRecRules []rulefmt.Rule
MetadataRecRules []rulefmt.Rule
AlertRules []rulefmt.Rule
}
SLORules are the prometheus rules required by an SLO.