Skip to content

SLO period windows

Sloth tries simplifying SLO generation and maintainability, thats why uses safe defaults and removes a lot of knobs/settings. If you don't need custom SLO period windows is encouraged that you use Sloth's 30 day default one.

Default SLO period catalog

Sloth can load a catalog of SLO period windows when it starts. By default Sloth comes with some well known SLO period windows loaded:

  • 30 day: SRE workbook month SLO period.
  • 28 day: Similar to the 30 day but in 4 weeks format.

Custom SLO period catalog

In case you want to fully customize your SLO period catalog (7 day period, adjust 30 day period alerting windows...). You can use AlertWindows/v1 spec.

Sloth will discover all SLO period window specs, load them on the SLO period catalog so the can be use them, by passing --slo-period-windows-path.

Some spec examples:

apiVersion: sloth.slok.dev/v1
kind: AlertWindows
spec:
  sloPeriod: 7d
  page:
    quick:
      errorBudgetPercent: 8
      shortWindow: 5m
      longWindow: 1h
    slow:
      errorBudgetPercent: 12.5
      shortWindow: 30m
      longWindow: 6h
  ticket:
    quick:
      errorBudgetPercent: 20
      shortWindow: 2h
      longWindow: 1d
    slow:
      errorBudgetPercent: 42
      shortWindow: 6h
      longWindow: 3d
apiVersion: sloth.slok.dev/v1
kind: AlertWindows
spec:
  sloPeriod: 30d
  page:
    quick:
      errorBudgetPercent: 1
      shortWindow: 2m
      longWindow: 30m
    slow:
      errorBudgetPercent: 2
      shortWindow: 15m
      longWindow: 3h
  ticket:
    quick:
      errorBudgetPercent: 5
      shortWindow: 1h
      longWindow: 12h
    slow:
      errorBudgetPercent: 5
      shortWindow: 3h
      longWindow: 36h

Multiple Sloth instances with different SLO period windows catalogs and defaults

You can have multiple Sloth instances with different default windows (with same or different slo period catalog) so you can have different behavior depending on the SLOs.

For example in Kubernetes you can run Sloth using label selectors to include/exclude SLOs that will process. E.g:

  • --label-selector=slo-window=7d
  • --label-selector=slo-window!=7d
  • --label-selector=environment=prod,tenant=5

Selecting default SLO period

Kubernetes and raw specs can's select an SLO period using the spec (because of simplicity), so, sloths fallbacks to its default slo period (30d). However, this can be changed using --default-slo-period.

Some examples:

  • Use default catalog and default 30 day (this would be the same as not specifying anything): --default-slo-period=30d.
  • Use default catalog with 28 day: --default-slo-period=28d.
  • Use custom catalog with 7 day: --default-slo-period=7d --slo-period-windows-path=/my/custom/slo/catalog.
  • Use custom catalog with 45 day: --default-slo-period=45d --slo-period-windows-path=/my/custom/slo/catalog.