openslo

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
const (
	KindSLO                     = openslo.KindSLO
	KindSLI                     = openslo.KindSLI
	KindService                 = openslo.KindService
	KindAlertPolicy             = openslo.KindAlertPolicy
	KindAlertCondition          = openslo.KindAlertCondition
	KindAlertNotificationTarget = openslo.KindAlertNotificationTarget
)

Re-export kind constants

View Source
const (
	SeverityCritical = slogo.SeverityCritical
	SeverityHigh     = slogo.SeverityHigh
	SeverityMedium   = slogo.SeverityMedium
	SeverityLow      = slogo.SeverityLow
	SeverityInfo     = slogo.SeverityInfo
)

Severity constants re-exported from slogo

View Source
const APIVersion = v1.APIVersion

APIVersion is the OpenSLO API version.

Variables

View Source
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

func NewAvailabilitySLO(service, name string, target float64, window string) v1.SLO

NewAvailabilitySLO creates an availability SLO.

func NewLabels

func NewLabels(labels map[string]string) v1.Labels

NewLabels creates OpenSLO labels from a map.

func NewLatencySLO

func NewLatencySLO(service, name, threshold string, target float64, window string) v1.SLO

NewLatencySLO creates a latency SLO.

func NewService

func NewService(name, description string) v1.Service

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 AlertPolicy

type AlertPolicy = v1.AlertPolicy

AlertPolicy represents an OpenSLO AlertPolicy.

type Labels

type Labels = v1.Labels

Labels is a map of label key to values.

type Metadata

type Metadata = v1.Metadata

Metadata contains object metadata.

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 Objects

type Objects = slogo.Objects

Objects is a collection of OpenSLO objects.

type SLO

type SLO = v1.SLO

SLO represents a Service Level Objective.

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) Build

func (b *SLOBuilder) Build() v1.SLO

Build creates 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.

type SLOSpec

type SLOSpec = v1.SLOSpec

SLOSpec defines the SLO specification.

type Service

type Service = v1.Service

Service represents an OpenSLO Service definition.

Jump to

Keyboard shortcuts

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