conventions

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: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PromRuleGroupNameSLOSLIPrefix        = "sloth-slo-sli-recordings-"
	PromRuleGroupNameSLOMetadataPrefix   = "sloth-slo-meta-recordings-"
	PromRuleGroupNameSLOAlertsPrefix     = "sloth-slo-alerts-"
	PromRuleGroupNameSLOExtraRulesPrefix = "sloth-slo-extra-rules-"
)
View Source
const (
	// Metrics SLI.
	PromSLIErrorMetric    = "slo:sli_error:ratio_rate"
	PromSLIErrorMetricFmt = PromSLIErrorMetric + "%s"

	// Metrics meta.
	PromMetaSLOObjectiveRatioMetric                  = "slo:objective:ratio"
	PromMetaSLOErrorBudgetRatioMetric                = "slo:error_budget:ratio"
	PromMetaSLOTimePeriodDaysMetric                  = "slo:time_period:days"
	PromMetaSLOCurrentBurnRateRatioMetric            = "slo:current_burn_rate:ratio"
	PromMetaSLOPeriodBurnRateRatioMetric             = "slo:period_burn_rate:ratio"
	PromMetaSLOPeriodErrorBudgetRemainingRatioMetric = "slo:period_error_budget_remaining:ratio"
	PromMetaSLOInfoMetric                            = "sloth_slo_info"

	// Labels.
	PromSLONameLabelName      = "sloth_slo"
	PromSLOIDLabelName        = "sloth_id"
	PromSLOServiceLabelName   = "sloth_service"
	PromSLOWindowLabelName    = "sloth_window"
	PromSLOSeverityLabelName  = "sloth_severity"
	PromSLOVersionLabelName   = "sloth_version"
	PromSLOModeLabelName      = "sloth_mode"
	PromSLOSpecLabelName      = "sloth_spec"
	PromSLOObjectiveLabelName = "sloth_objective"
)

Prometheus metrics conventions.

Variables

View Source
var (
	// NameRegexp is the regex to validate SLO, SLI and in general safe names and IDs.
	// Names must:
	// - Start and end with an alphanumeric.
	// - Contain alphanumeric, `.`, '_', and '-'.
	NameRegexpStr = `^[A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]$`
	NameRegexp    = regexp.MustCompile(NameRegexpStr)

	// TplSLIQueryWindowVarRegex is the regex to match the {{ .window }} template variable used in the SLI queries.
	TplSLIQueryWindowVarRegex = regexp.MustCompile(`{{ *\.window *}}`)

	// TplSLIQueryWindowVarName is the name of the window template variable used in the SLI queries.
	TplSLIQueryWindowVarName = "window"
)

Functions

func GetSLIErrorMetric

func GetSLIErrorMetric(window time.Duration) string

GetSLIErrorMetric returns the SLI error Prometheus metric name.

func GetSLOIDPromLabels

func GetSLOIDPromLabels(s model.PromSLO) map[string]string

GetSLOIDPromLabels returns the ID labels of an SLO, these can be used to identify an SLO recorded metrics and alerts.

Types

This section is empty.

Jump to

Keyboard shortcuts

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