Skip to content

Instantly share code, notes, and snippets.

@soasme
Last active December 15, 2021 21:53
Show Gist options
  • Save soasme/ac7e9d9286793c2466d8c9de959489cb to your computer and use it in GitHub Desktop.
Save soasme/ac7e9d9286793c2466d8c9de959489cb to your computer and use it in GitHub Desktop.

Overview

In this document, I propose to separate SLI from SLO as a new data kind in OpenSLO specification. See discussion #29.

SLI

A service level indicator (SLI) represents how to gather data from metric sources.

apiVersion: openslo/v0.2.0-beta
kind: SLI
metadata:
  name: string
  displayName: string # optional
spec:
  thresholdMetric: # either thresholdMetric or ratioMetric should be provided
    source: string # data source for the metric
    queryType: string # a name for the type of query to run on the data source
    query: string # the query to run to return the metric
    metadata: # optional, allows data source specific details to be passed
  ratioMetric: # either thresholdMetric or ratioMetric should be provided
    counter: true | false # true if the metric is a monotonically increasing counter,
                          # or false, if it is a single number that can arbitrarily go up or down
    good: # the numerator
      source: string # data source for the "good" numerator
      queryType: string # a name for the type of query to run on the data source
      query: string # the query to run to return the numerator
      metadata: # optional, allows data source specific details to be passed
    bad: # the numerator, required when "good" is not set
      source: string # data source for the "bad" numerator
      queryType: string # a name for the type of query to run on the data source
      query: string # the query to run to return the numerator
      metadata: # optional, allows data source specific details to be passed
    total: # the denominator
      source: string # data source for the "total" denominator
      queryType: string # a name for the type of query to run on the data source
      query: string # the query to run to return the denominator
      metadata: # optional, allows data source specific details to be passed

SLO

A service level objective (SLO) is a target value or range of values for a service level that is described by a service level indicator (SLI).

apiVersion: openslo/v0.2.0-beta
kind: SLO
metadata:
  name: string
  displayName: string # optional
  labels: # optional, key <>value a pair of labels that can be used as metadata relevant to users
    userImpacting: "true"
    team: "identity"
    costCentre: "project1"
    serviceTier: "tier-1"
    tags:
      - auth
  annotations: map[string]string # optional, key <> value a pair of annotations that can be used as implementation metadata
    openslo.com/key1: value1
    fooimplementation.com/key2: value2
spec:
  description: string # optional
  service: [service name] # name of the service to associate this SLO with
  indicatorRef: string # name of the indicator
  indicator: # see SLI.spec above for details
  timeWindow:
    # exactly one item, one of possible rolling time window or calendar aligned
    # rolling time window
    - unit: Second
      count: numeric
      isRolling: true
    # or
    # calendar aligned time window
    - unit: Year | Quarter | Month | Week | Day
      count: numeric # count of time units for example count: 7 and unit: Day means 7 days window
      calendar:
        startTime: 2020-01-21 12:30:00 # date with time in 24h format, format without time zone
        timeZone: America/New_York # name as in IANA Time Zone Database
      isRolling: false # false or not defined
  budgetingMethod: Occurrences | Timeslices
  objectives: # see objectives below for details
  alertPolicies: # see alert policies below details

Objectives

Objectives are the thresholds for your SLOs. You can use objectives to define the tolerance levels for your metrics

objectives:
  - displayName: string # optional
    op: lte | gte | lt | gt # conditional operator used to compare the SLI against the value. Only needed when using a thresholdMetric
    value: numeric # optional, value used to compare threshold metrics. Only needed when using a thresholdMetric
    target: numeric [0.0, 1.0) # budget target for given objective of the SLO
    timeSliceTarget: numeric (0.0, 1.0] # required only when budgetingMethod is set to TimeSlices
    timeSliceWindow: number | duration-shorthand # required only when budgetingMethod is set to TimeSlices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment