conventions

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Metrics.
	PromSLIErrorMetricFmt = "slo:sli_error:ratio_rate%s"

	// 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 '-'.
	NameRegexp = regexp.MustCompile(`^[A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]$`)

	// TplWindowRegex is the regex to match the {{ .window }} template variable.
	TplWindowRegex = regexp.MustCompile(`{{ *\.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