SLO (v1)¶
SLO represents a target value or range for a service level measured by an SLI.
Examples¶
apiVersion: openslo/v1
kind: SLO
metadata:
name: main-page
displayName: Main page availability
spec:
description: Our main page should be available always
service: web-shop
indicator:
metadata:
name: response-code
displayName: Response codes of requests to main page
spec:
ratioMetric:
good:
metricSource:
type: Any # Here put any service that holds information you need.
spec: # Fields necessary to query service for the data.
query: Any # 'query' is just an example field.
total:
metricSource:
type: Any # Here put any service that holds information you need.
spec: # Fields necessary to query service for the data.
query: Any # 'query' is just an example field.
timeWindow:
- duration: 2w
isRolling: true
budgetingMethod: RatioTimeslices
objectives:
- displayName: Good
timeSliceWindow: 1m
target: 0.99
Properties¶
apiVersion¶
string required
Version represents a version of the OpenSLO specification.
Allowed values: openslo/v1
Validation rules
| Rule |
|---|
| property is required |
must be equal to openslo/v1 |
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 the service association, indicator placement, budgeting method, evaluation window, objectives, and alert policies of an SLO.
Validation rules
| Rule | Applies when |
|---|---|
| property is required | |
indicator or indicatorRef fields must either be defined on the spec level (standard SLOs) or on the spec.objectives[*] level (composite SLOs) |
|
exactly one of indicator and indicatorRef must be set |
indicator or indicatorRef 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.service ¶
string required
Service names the associated service. Consumers define how to resolve the name to a Service.
Validation rules
| Rule |
|---|
| property is required |
spec.indicator ¶
struct reference
Indicator defines a standard SLO's SLI inline. Composite SLOs place indicators on individual Objectives.
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 | indicator or indicatorRef is set |
spec.indicatorRef ¶
string
IndicatorRef names an existing SLI for a standard SLO. Composite SLOs place indicator references on individual Objectives.
Validation rules
| Rule | Applies when | Details | Examples |
|---|---|---|---|
| property is optional | indicator or indicatorRef is set |
||
| length must be between 1 and 63 | indicator or indicatorRef is set |
||
string must match regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ |
indicator or indicatorRef 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 identifies how an SLO aggregates SLI results for objective and error-budget evaluation. An objective's error-budget fraction is 1 minus SLOObjective.Target. Its error-budget percentage is 100 minus SLOObjective.TargetPercent. Occurrences uses the ratio of good events to total events. Timeslices counts slices that meet SLOObjective.TimeSliceTarget. RatioTimeslices averages success ratios across slices. Composite calculation rules depend on the method, as the constant comments describe.
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 defines 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 case-sensitive 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, M, Q, Y
| Rule |
|---|
| property is required |
| must be one of: m, h, d, w, M, Q, Y |
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 anchors a calendar-aligned SLOTimeWindow in a time zone.
Validation rules
| Rule |
|---|
| property is optional |
spec.timeWindow[*].calendar.startTime ¶
string
StartTime anchors the first calendar window.
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 controls the interpretation of StartTime and later boundaries.
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 target definitions.
spec.objectives[*] ¶
struct
SLOObjective defines a success target and, when applicable, a threshold comparison or composite-specific indicator. For example, Target 0.995 and TargetPercent 99.5 both express a 99.5 percent target.
Validation rules
| Rule | Applies when |
|---|---|
exactly one of target and targetPercent must be set |
|
exactly one of indicator and indicatorRef must be set |
is composite SLO and indicator or indicatorRef is set |
spec.objectives[*].displayName ¶
string
DisplayName is the objective's human-readable name.
spec.objectives[*].op ¶
string conditionally required
Operator compares threshold-metric samples with Value.
Operator identifies a comparison applied to a metric value.
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 | indicator.spec.ratioMetric is set |
| property is required | indicator.spec.thresholdMetric is set |
| must be one of: gt, lt, gte, lte | indicator.spec.thresholdMetric is set |
spec.objectives[*].value ¶
float64 conditionally required
Value sets the threshold for metric sample comparisons. It is distinct from the success target expressed by Target or TargetPercent.
Validation rules
| Rule | Applies when |
|---|---|
| property is forbidden | indicator.spec.ratioMetric is set |
| property is required | indicator.spec.thresholdMetric is set |
spec.objectives[*].target ¶
float64
Target expresses the success target as a fraction.
Validation rules
| Rule |
|---|
| property is optional |
must be greater than or equal to 0 |
must be less than 1 |
spec.objectives[*].targetPercent ¶
float64
TargetPercent expresses the success target as a 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 classifies a slice as good when BudgetingMethod is SLOBudgetingMethodTimeslices.
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 slice size and query interval. It applies to SLOBudgetingMethodTimeslices and SLOBudgetingMethodRatioTimeslices. This Go model supports DurationShorthand only. OpenSLO also permits a number, which it interprets as minutes.
DurationShorthand represents a duration as an integer and a case-sensitive 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: M, Q, Y, d, h, m, w
| Rule | Applies when |
|---|---|
| property is required | budgetingMethod is Timeslices |
| must be one of: m, h, d, w, M, Q, Y | budgetingMethod is Timeslices |
| property is required | budgetingMethod is RatioTimeslices |
| must be one of: m, h, d, w, M, Q, Y | 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[*].indicator ¶
struct reference
Indicator defines this objective's SLI inline 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 indicator or indicatorRef is set |
spec.objectives[*].indicatorRef ¶
string
IndicatorRef names this objective's SLI for a composite SLO.
Validation rules
| Rule | Applies when | Details | Examples |
|---|---|---|---|
| property is optional | is composite SLO and indicator or indicatorRef is set |
||
| length must be between 1 and 63 | is composite SLO and indicator or indicatorRef is set |
||
string must match regular expression: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ |
is composite SLO and indicator or indicatorRef 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. OpenSLO 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 supplies an inline or referenced alert policy to 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 matches the Metadata.Name of an existing AlertPolicy.
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 |