Documentation
¶
Overview ¶
Package openslo provides types for OpenSLO (Service Level Objectives).
OpenSLO is an open standard for defining SLOs in a vendor-agnostic way. See: https://github.com/OpenSLO/OpenSLO
This package wraps the official OpenSLO Go SDK via slogo, providing helper functions for common SLO patterns.
Index ¶
- Constants
- Variables
- func NewAvailabilitySLO(service, name string, target float64, window string) v1.SLO
- func NewLabels(labels map[string]string) v1.Labels
- func NewLatencySLO(service, name, threshold string, target float64, window string) v1.SLO
- func NewService(name, description string) v1.Service
- type AlertCondition
- type AlertNotificationTarget
- type AlertPolicy
- type Labels
- type Metadata
- type MetricSource
- type Objects
- type SLO
- type SLOBuilder
- func (b *SLOBuilder) AddAlertPolicyRef(ref string) *SLOBuilder
- func (b *SLOBuilder) AddObjective(target float64, timeWindow string) *SLOBuilder
- func (b *SLOBuilder) Build() v1.SLO
- func (b *SLOBuilder) WithDescription(desc string) *SLOBuilder
- func (b *SLOBuilder) WithLabels(labels map[string]string) *SLOBuilder
- func (b *SLOBuilder) WithRatioMetric(good, total MetricSource) *SLOBuilder
- func (b *SLOBuilder) WithThresholdMetric(metric, threshold, aggregation string) *SLOBuilder
- type SLOSpec
- type Service
Constants ¶
const ( KindSLO = openslo.KindSLO KindSLI = openslo.KindSLI KindService = openslo.KindService KindAlertPolicy = openslo.KindAlertPolicy KindAlertCondition = openslo.KindAlertCondition KindAlertNotificationTarget = openslo.KindAlertNotificationTarget )
Re-export kind constants
const ( SeverityCritical = slogo.SeverityCritical SeverityHigh = slogo.SeverityHigh SeverityMedium = slogo.SeverityMedium SeverityLow = slogo.SeverityLow SeverityInfo = slogo.SeverityInfo )
Severity constants re-exported from slogo
const APIVersion = v1.APIVersion
APIVersion is the OpenSLO API version.
Variables ¶
var ( // NewAlertCondition creates a new AlertCondition with burn rate configuration. NewAlertCondition = slogo.NewAlertCondition // NewAlertNotificationTarget creates a new AlertNotificationTarget. NewAlertNotificationTarget = slogo.NewAlertNotificationTarget // NewAlertPolicyBuilder creates a new AlertPolicyBuilder. NewAlertPolicyBuilder = slogo.NewAlertPolicyBuilder // StandardBurnRateAlerts returns standard multi-window burn rate alert conditions. StandardBurnRateAlerts = slogo.StandardBurnRateAlerts )
Alert helper re-exports from slogo
Functions ¶
func NewAvailabilitySLO ¶
NewAvailabilitySLO creates an availability SLO.
func NewLatencySLO ¶
NewLatencySLO creates a latency SLO.
func NewService ¶
NewService creates a new Service definition.
Types ¶
type AlertCondition ¶
type AlertCondition = v1.AlertCondition
AlertCondition represents an OpenSLO AlertCondition.
type AlertNotificationTarget ¶
type AlertNotificationTarget = v1.AlertNotificationTarget
AlertNotificationTarget represents an OpenSLO AlertNotificationTarget.
type MetricSource ¶
type MetricSource struct {
// Metric is the metric name/query.
Metric string
// Filter is an optional filter expression.
Filter string
}
MetricSource identifies a metric for SLI calculation. This is a simplified wrapper for building SLIs.
type SLOBuilder ¶
type SLOBuilder struct {
// contains filtered or unexported fields
}
SLOBuilder provides a fluent interface for building SLO objects.
func NewSLO ¶
func NewSLO(name, service string) *SLOBuilder
NewSLO creates a new SLO builder with the given name and service.
func (*SLOBuilder) AddAlertPolicyRef ¶
func (b *SLOBuilder) AddAlertPolicyRef(ref string) *SLOBuilder
AddAlertPolicyRef adds a reference to an alert policy.
func (*SLOBuilder) AddObjective ¶
func (b *SLOBuilder) AddObjective(target float64, timeWindow string) *SLOBuilder
AddObjective adds an objective to the SLO.
func (*SLOBuilder) WithDescription ¶
func (b *SLOBuilder) WithDescription(desc string) *SLOBuilder
WithDescription sets the SLO description.
func (*SLOBuilder) WithLabels ¶
func (b *SLOBuilder) WithLabels(labels map[string]string) *SLOBuilder
WithLabels sets the SLO labels.
func (*SLOBuilder) WithRatioMetric ¶
func (b *SLOBuilder) WithRatioMetric(good, total MetricSource) *SLOBuilder
WithRatioMetric sets a ratio-based SLI (good/total).
func (*SLOBuilder) WithThresholdMetric ¶
func (b *SLOBuilder) WithThresholdMetric(metric, threshold, aggregation string) *SLOBuilder
WithThresholdMetric sets a threshold-based SLI.