SLO (v2alpha)¶
SLO defines a target for an SLI over a time window.
Properties¶
apiVersion¶
string required
Version represents a version of the OpenSLO specification.
Allowed values: openslo.com/v2alpha
Validation rules
| Rule |
|---|
| property is required |
must be equal to openslo.com/v2alpha |
kind¶
string required
Kind represents all the object kinds defined by OpenSLO specification. Keep in mind not all specification versions support every Kind.
Allowed values: SLO
Validation rules
| Rule |
|---|
| property is required |
must be equal to SLO |
metadata¶
struct required reference
See the metadata definition in the overview.
Validation rules
| Rule |
|---|
| property is required |
spec¶
struct required
SLOSpec defines an SLO's service, SLI, time window, budgeting method, objectives, and alert policies. A standard SLO applies one SLI to all objectives. A composite SLO can select a different SLI per objective.
Validation rules
| Rule | Applies when |
|---|---|
| property is required | |
sli or sliRef fields must either be defined on the spec level (standard SLOs) or on the spec.objectives[*] level (composite SLOs) |
|
exactly one of sli and sliRef must be set |
sli or sliRef is set |
spec.description ¶
string
Description summarizes the SLO.
Validation rules
| Rule |
|---|
| property is optional |
| length must be less than or equal to 1050 |
spec.serviceRef ¶
string required
ServiceRef names the service associated with this SLO. The SDK serializes the field as "serviceRef". The living v2alpha proposal calls it "service".
Validation rules
| Rule |
|---|
| property is required |
spec.sli ¶
struct reference
SLI embeds the service level indicator for a standard SLO.
Use the metadata and spec properties from the SLI definition. The inline form omits apiVersion and kind.
Validation rules
| Rule | Applies when |
|---|---|
| property is optional | sli or sliRef is set |
spec.sliRef ¶
string
SLIRef names an existing SLI for a standard SLO.
Validation rules
| Rule | Applies when | Details | Examples |
|---|---|---|---|
| property is optional | sli or sliRef is set |
||
| length must be between 1 and 63 | sli or sliRef is set |
||
string must match regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ |
sli or sliRef is set |
an RFC-1123 compliant label name must consist of lower case alphanumeric characters or -, and must start and end with an alphanumeric character |
my-name123-abc |
spec.budgetingMethod ¶
string required
BudgetingMethod applies the selected error-budget calculation to every objective.
SLOBudgetingMethod selects how an SLO consumes its error budget. Occurrences uses good events over total events, Timeslices uses good slices over total slices, and RatioTimeslices averages slice success ratios.
Allowed values: Occurrences, Timeslices, RatioTimeslices
Validation rules
| Rule |
|---|
| property is required |
| must be one of: Occurrences, Timeslices, RatioTimeslices |
spec.timeWindow ¶
[]struct
TimeWindow defines the period over which the SLO is evaluated.
Validation rules
| Rule |
|---|
| length must be between 1 and 1 |
spec.timeWindow[*] ¶
struct
SLOTimeWindow describes one rolling or calendar-aligned evaluation window.
Validation rules
| Rule |
|---|
calendar must be set when isRolling is false and cannot be set when isRolling is true |
spec.timeWindow[*].duration ¶
string required
Duration is the length of the evaluation window.
DurationShorthand represents a duration as an integer and a DurationShorthandUnit, such as "1m" or "10d". A zero value encodes as empty text.
Validation rules
| Rule |
|---|
| property is required |
Validation of value components
These rules apply to parts of this value.
Component: unit
Possible values: m, h, d, w
| Rule |
|---|
| property is required |
| must be one of: m, h, d, w |
Component: value
| Rule |
|---|
must be greater than or equal to 0 |
spec.timeWindow[*].isRolling ¶
bool
IsRolling selects a rolling window when true and a calendar-aligned window when false.
spec.timeWindow[*].calendar ¶
struct
Calendar defines the alignment of a calendar window.
SLOCalendar defines the starting wall-clock time and time zone for a calendar-aligned SLOTimeWindow.
Validation rules
| Rule |
|---|
| property is optional |
spec.timeWindow[*].calendar.startTime ¶
string
StartTime is the local date and time when calendar alignment starts.
Validation rules
| Rule | Details |
|---|---|
string must be a valid date and time in 2006-01-02 15:04:05 format |
date and time format follows Go's time layout, see https://pkg.go.dev/time#Layout for more details |
spec.timeWindow[*].calendar.timeZone ¶
string
TimeZone determines how StartTime maps to an instant.
Validation rules
| Rule | Examples |
|---|---|
| string must be a valid IANA Time Zone Database code | UTCAmerica/New_YorkEurope/Warsaw |
spec.objectives ¶
[]struct
Objectives contains the SLO's budget targets and metric thresholds.
spec.objectives[*] ¶
struct
SLOObjective defines one error-budget target and, for a threshold SLI, its metric comparison. The living v2alpha proposal also defines objective labels, which this SDK does not model.
Validation rules
| Rule | Applies when |
|---|---|
exactly one of target and targetPercent must be set |
|
exactly one of sli and sliRef must be set |
is composite SLO and sli or sliRef is set |
spec.objectives[*].displayName ¶
string
DisplayName is a human-readable name for this objective. It is not part of the enclosing object's Metadata.
spec.objectives[*].op ¶
string conditionally required
Operator compares a threshold metric with Value.
Operator specifies a comparison operation for an SLO objective or alert condition.
Possible values: gt, lt, gte, lte
The applicable values depend on the conditions in the validation rules below.
Validation rules
| Rule | Applies when |
|---|---|
| property is forbidden | sli.spec.ratioMetric is set |
| property is required | sli.spec.thresholdMetric is set |
| must be one of: gt, lt, gte, lte | sli.spec.thresholdMetric is set |
spec.objectives[*].value ¶
float64 conditionally required
Value is the comparison threshold for a threshold metric.
Validation rules
| Rule | Applies when |
|---|---|
| property is forbidden | sli.spec.ratioMetric is set |
| property is required | sli.spec.thresholdMetric is set |
spec.objectives[*].target ¶
float64
Target is the desired success proportion. For example, 0.995 means 99.5 percent.
Validation rules
| Rule |
|---|
| property is optional |
must be greater than or equal to 0 |
must be less than 1 |
spec.objectives[*].targetPercent ¶
float64
TargetPercent is the desired success percentage.
Validation rules
| Rule |
|---|
| property is optional |
must be greater than or equal to 0 |
must be less than 100 |
spec.objectives[*].timeSliceTarget ¶
float64 conditionally required
TimeSliceTarget sets the per-slice success threshold for Timeslices.
Validation rules
| Rule | Applies when |
|---|---|
| property is required | budgetingMethod is Timeslices |
must be greater than 0 |
budgetingMethod is Timeslices |
must be less than or equal to 1 |
budgetingMethod is Timeslices |
spec.objectives[*].timeSliceWindow ¶
string conditionally required
TimeSliceWindow sets the size of each slice for Timeslices and RatioTimeslices. OpenSLO also accepts a number interpreted as minutes. This SDK represents only duration shorthand.
DurationShorthand represents a duration as an integer and a DurationShorthandUnit, such as "1m" or "10d". A zero value encodes as empty text.
Validation rules
| Rule | Applies when |
|---|---|
| property is required | budgetingMethod is Timeslices |
| property is required | budgetingMethod is RatioTimeslices |
Validation of value components
These rules apply to parts of this value.
Component: unit
Possible values: d, h, m, w
| Rule | Applies when |
|---|---|
| property is required | budgetingMethod is Timeslices |
| must be one of: m, h, d, w | budgetingMethod is Timeslices |
| property is required | budgetingMethod is RatioTimeslices |
| must be one of: m, h, d, w | budgetingMethod is RatioTimeslices |
Component: value
| Rule | Applies when |
|---|---|
must be greater than or equal to 0 |
budgetingMethod is Timeslices |
must be greater than or equal to 0 |
budgetingMethod is RatioTimeslices |
spec.objectives[*].sli ¶
struct reference
SLI embeds this objective's service level indicator for a composite SLO.
Use the metadata and spec properties from the SLI definition. The inline form omits apiVersion and kind.
Validation rules
| Rule | Applies when |
|---|---|
| property is optional | is composite SLO and sli or sliRef is set |
spec.objectives[*].sliRef ¶
string
SLIRef names this objective's existing SLI for a composite SLO.
Validation rules
| Rule | Applies when | Details | Examples |
|---|---|---|---|
| property is optional | is composite SLO and sli or sliRef is set |
||
| length must be between 1 and 63 | is composite SLO and sli or sliRef is set |
||
string must match regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ |
is composite SLO and sli or sliRef is set |
an RFC-1123 compliant label name must consist of lower case alphanumeric characters or -, and must start and end with an alphanumeric character |
my-name123-abc |
spec.objectives[*].compositeWeight ¶
float64
CompositeWeight scales this objective's contribution to a composite SLO. The living v2alpha proposal defaults it to 1, but this SDK preserves an omitted value as nil.
Validation rules
| Rule | Applies when |
|---|---|
| property is optional | is composite SLO |
must be greater than 0 |
is composite SLO |
spec.alertPolicies ¶
[]struct
AlertPolicies contains inline alert policies or references to existing AlertPolicy objects.
spec.alertPolicies[*] ¶
struct
SLOAlertPolicy associates an inline or referenced alert policy with an SLO.
Validation rules
| Rule |
|---|
exactly one of alertPolicyRef and spec must be set |
| property is optional |
spec.alertPolicies[*].kind ¶
string required
Kind represents all the object kinds defined by OpenSLO specification. Keep in mind not all specification versions support every Kind.
Allowed values: AlertPolicy
Validation rules
| Rule |
|---|
| property is required |
must be equal to AlertPolicy |
spec.alertPolicies[*].metadata ¶
struct required reference
See the metadata definition in the overview.
Validation rules
| Rule |
|---|
| property is required |
spec.alertPolicies[*].spec ¶
struct required reference
See the AlertPolicy specification.
Validation rules
| Rule |
|---|
| property is required |
spec.alertPolicies[*].alertPolicyRef ¶
string required
AlertPolicyRef is the metadata name of the alert policy to use.
Validation rules
| Rule | Details | Examples |
|---|---|---|
| property is required | ||
| length must be between 1 and 63 | ||
string must match regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ |
an RFC-1123 compliant label name must consist of lower case alphanumeric characters or -, and must start and end with an alphanumeric character |
my-name123-abc |