Skip to content

Define Your Service Level Objectives

Sloth enables you to define and manage Service Level Objectives (SLOs) efficiently.

To begin defining SLOs, create a PrometheusServiceLevel resource by specifying queries and objectives. If these objectives are not met, Prometheus will trigger corresponding alerts.

Here is an example configuration:

slo.yaml
apiVersion: sloth.slok.dev/v1
kind: PrometheusServiceLevel
metadata:
name: sampleapp-slo
spec:
service: external
slos:
- name: sampleapp-available
objective: 99.0
description: "The sampleapp app should serve requests without errors 99% of the time"
sli:
events:
errorQuery: sum(rate(nginx_ingress_controller_requests{host="sampleapp.ref+file://config.yaml#/ingress/domainName+",status=~"(5..|429)"}[{{.window}}]))
totalQuery: sum(rate(nginx_ingress_controller_requests{host="sampleapp.ref+file://config.yaml#/ingress/domainName+"}[{{.window}}]))
alerting:
name: SampleAppNotAvailable
labels:
category: availability
annotations:
summary: "https://sampleapp.ref+file://config.yaml#/ingress/domainName+/ is not available"

To ensure your integration is successful, navigate to the alerts list in your Grafana UI or the “Sloth - SLO / Detail” dashboard. Here, you can access the global SLO list, including your newly created SLO.