Which SLO tool pages first when checkout starts throwing 500s? I put a Sloth SLO and a Pyrra SLO on the same Prometheus, pointed both at one small shop service, and broke it on purpose. Both tools turn a short YAML file into multi-window, multi-burn-rate alerts. They do not produce the same alerts, though, and the difference showed up as a page that arrived ten minutes after the errors had stopped.
These are my notes from that run: both specs, every generated rule I loaded, Alertmanager routing for page and ticket, both web UIs, a Grafana error budget dashboard and a minute-by-minute fault timeline. I ran all of it in November 2026 on an Ubuntu 26.04.1 LTS VM called box1, with Prometheus 3.16.0, Alertmanager 0.35.0, Grafana 13.3.1, Sloth v0.16.0 and Pyrra 0.10.2, and every output below comes from that box.
What multi-window, multi-burn-rate alerts buy you
A burn-rate alert fires when you’re spending error budget faster than the SLO period can afford, and the multi-window version only fires when a long window and a short window agree. Why bother with two windows? The long window proves the burn is big enough to matter, while the short window proves it’s still happening, so the alert clears soon after a fix instead of firing for hours. It’s the scheme from the SRE Workbook chapter on alerting on SLOs, and both tools implement it, each adding a fourth row to the three the workbook recommends.
A 99.9% SLO over 30 days leaves an error budget of 0.1%. A burn rate of 14.4 means 1.44% of requests are failing, which empties the whole month’s budget in about two days. For each SLO, Sloth wrote these four conditions:
- Page: 5m and 1h both above 14.4x the budget
- Page: 30m and 6h both above 6x
- Ticket: 2h and 1d both above 3x
- Ticket: 6h and 3d both above 1x
Pyrra also writes four burn-rate alerts, but its factors are 14, 7, 2 and 1, its windows have odd lengths such as 1h4m and 6h26m, and every alert carries a for: clause. Those three differences explain almost everything that diverged during the fault run, so it’s worth reading the generated rules before you get to the comparison table at the end.
Laying out the lab, its sizing and versions
Everything ran on one e2-standard-4 VM (4 vCPUs, 16 GB of RAM) with the user philip. A small Python shop app takes 20 requests per second from hey, and Prometheus scrapes it every 15 seconds and evaluates rules every 30. Sloth and Pyrra each write a rule file into a directory that Prometheus loads, Alertmanager splits alerts between a page receiver and a ticket receiver, and Grafana reads the same Prometheus.

In the diagram, the red path is the first thing that went wrong, because with no 500s served yet the availability error query returned nothing at all. The note beside Pyrra marks the second surprise. These are the ports I used, so change any that something on your machine already holds.
| Component | Port | Role in the lab |
|---|---|---|
| Shop app | 8080 | Counter plus latency histogram, fault switch in /etc/shop/fault |
| Prometheus | 9090 | Scrapes, evaluates both tools’ rules |
| Alertmanager | 9093 | Routes page and ticket |
| Grafana | 3000 | Sloth community dashboards |
| Sloth server | 8082 (status 8083) | Sloth web UI at /u |
| Pyrra API and UI | 9099 | Pyrra web UI |
| Pyrra filesystem backend | 9444 | Reads specs, writes rules |
| Webhook catcher | 5001 | Stands in for PagerDuty and a ticket queue |
Treat that box as a floor, not a recommendation. Neither tool costs much by itself, since the cost is the rules, and two SLOs added 62 of them here. The long-window ones (3d, 30d, 4d6h51m) are range queries over days of raw samples, which is where evaluation time grows along with your series count. Once the rules are loaded on a production Prometheus, watch prometheus_rule_group_last_duration_seconds and size for active series rather than for the SLO tooling.
Instrumenting a small shop app
Neither tool measures anything itself. Both only write PromQL over series you already scrape, so before either can help, the app has to expose two series that can be turned into ratios:
- A request counter with a status code label
- A latency histogram with a bucket exactly at your threshold
My latency target was 300 ms, so I listed an le="0.3" bucket explicitly, because without it the latency SLI has no count of fast requests to subtract. The app needs the Prometheus client library for Python, and the load generator is hey, both straight from the Ubuntu archive.
sudo apt install -y python3-prometheus-client hey
sudo mkdir -p /opt/shop /etc/shop
echo off | sudo tee /etc/shop/fault
Next, create the app itself in /opt/shop, where the service unit will look for it. The unit runs it with the system python3, so there’s no virtualenv to manage.
sudo vim /opt/shop/app.py
It serves one endpoint, /api/checkout, and reads the fault file on every request so you can break it without a restart. Reading a file per request would be silly in production. In a lab it means the fault switch needs no signal handling and no admin API.
import random
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from prometheus_client import CONTENT_TYPE_LATEST, Counter, Histogram, generate_latest
REQUESTS = Counter("http_requests_total", "HTTP requests", ["handler", "method", "code"])
LATENCY = Histogram(
"http_request_duration_seconds",
"Request latency",
["handler"],
buckets=(0.05, 0.1, 0.25, 0.3, 0.5, 1, 2.5),
)
def fault():
try:
return open("/etc/shop/fault").read().strip()
except OSError:
return "off"
class Handler(BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_GET(self):
if self.path == "/metrics":
body = generate_latest()
self.send_response(200)
self.send_header("Content-Type", CONTENT_TYPE_LATEST)
self.end_headers()
self.wfile.write(body)
return
if self.path != "/api/checkout":
self.send_response(404)
self.end_headers()
return
start = time.time()
mode = fault()
code = 200
delay = random.uniform(0.02, 0.12)
if mode == "errors" and random.random() < 0.30:
code = 500
if mode == "slow" and random.random() < 0.25:
delay = random.uniform(0.6, 0.9)
time.sleep(delay)
self.send_response(code)
self.end_headers()
self.wfile.write(b"ok\n" if code == 200 else b"error\n")
LATENCY.labels("/api/checkout").observe(time.time() - start)
REQUESTS.labels("/api/checkout", "GET", str(code)).inc()
ThreadingHTTPServer(("0.0.0.0", 8080), Handler).serve_forever()
The fault file takes one of three words:
errors: 30% of requests return 500slow: 25% of requests take 0.6 to 0.9 secondsoff: back to normal
Each fault burns a different SLO, which let me watch both alert families in one run without restarting anything. The service unit is short, because the app needs no arguments and no environment.
sudo vim /etc/systemd/system/shop.service
Paste this in, and adjust the path if you put the app somewhere else. Restart=always brings the app back if it crashes, which matters because a dead app produces no samples, and no samples means no burn to alert on.
[Unit]
Description=Sample shop app
After=network.target
[Service]
ExecStart=/usr/bin/python3 /opt/shop/app.py
Restart=always
[Install]
WantedBy=multi-user.target
The load generator gets its own unit, so the traffic survives logouts and reboots without anyone babysitting a terminal. Its After=shop.service line orders it behind the app on boot.
sudo vim /etc/systemd/system/shop-load.service
Four workers at five requests each gives a steady 20 requests per second, which Prometheus later measured at exactly 20.0. A steady rate matters more than a high one, since every ratio below divides by it. The -z 24h flag just keeps hey running for a day before systemd restarts it.
[Unit]
Description=Load generator for shop
After=shop.service
[Service]
ExecStart=/usr/bin/hey -z 24h -c 4 -q 5 http://localhost:8080/api/checkout
Restart=always
[Install]
WantedBy=multi-user.target
Start both units and look at the metrics. You want to see the counter and the 0.3 bucket before writing a single SLO line:
sudo systemctl daemon-reload
sudo systemctl enable --now shop shop-load
curl -s localhost:8080/metrics | grep -E "^http_request(s_total|_duration_seconds_(count|bucket))" | head -12
A few seconds after start, all 249 requests were 200s and every one of them sat under 0.25 seconds. That’s the healthy baseline both SLOs measure against.
http_requests_total{code="200",handler="/api/checkout",method="GET"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="0.05"} 73.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="0.1"} 193.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="0.25"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="0.3"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="0.5"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="1.0"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="2.5"} 249.0
http_request_duration_seconds_bucket{handler="/api/checkout",le="+Inf"} 249.0
http_request_duration_seconds_count{handler="/api/checkout"} 249.0
Because the le="0.3" bucket equals the count, the latency SLI starts at zero errors. Look at what’s missing, though, since there’s no code="500" series anywhere. Why would there be? A counter for a label value that has never happened does not exist yet, and that turned into a real problem once the availability rules loaded.
Writing the Sloth spec and generating rules
Sloth ships as a single static binary, so installing it is a download, a check against the published checksums and a copy into /usr/local/bin. I pinned the release I tested so the generated rules below match what you’ll get.
SLOTH_VERSION="v0.16.0" # pin: version tested in this guide #https://github.com/slok/sloth/releases
curl -sL https://github.com/slok/sloth/releases/download/${SLOTH_VERSION}/sloth-linux-amd64 -o sloth-linux-amd64
curl -sL https://github.com/slok/sloth/releases/download/${SLOTH_VERSION}/checksums.txt -o sloth.sums
grep sloth-linux-amd64 sloth.sums | sha256sum -c -
sudo install sloth-linux-amd64 /usr/local/bin/sloth
The checksum line should end in OK before you trust the binary. Anything else means a bad download or a filename that doesn’t match the checksums file.
sloth-linux-amd64: OK
My spec holds two SLOs for the same service, one saying 99.9% of requests are not 5xx and one saying 99% of checkouts finish in under 300 ms. Create the file and the rules directory it’ll generate into.
sudo mkdir -p /etc/sloth /etc/prometheus/rules/sloth
sudo vim /etc/sloth/shop.yml
Sloth fills in {{.window}} once for each window it needs, so you write each query a single time and never touch a window length. That’s the main thing it saves you, because the hand-written version repeats every expression once per window.
version: "prometheus/v1"
service: "shop"
labels:
owner: "payments"
slos:
- name: "requests-availability"
objective: 99.9
description: "99.9% of shop requests succeed (non-5xx)."
sli:
events:
error_query: sum(rate(http_requests_total{job="shop",code=~"5.."}[{{.window}}]))
total_query: sum(rate(http_requests_total{job="shop"}[{{.window}}]))
alerting:
name: ShopHighErrorRate
labels:
category: "availability"
annotations:
summary: "High error rate on the shop service"
page_alert:
labels:
severity: page
ticket_alert:
labels:
severity: ticket
- name: "requests-latency"
objective: 99
description: "99% of checkout requests are faster than 300ms."
sli:
events:
error_query: (sum(rate(http_request_duration_seconds_count{job="shop",handler="/api/checkout"}[{{.window}}])) - sum(rate(http_request_duration_seconds_bucket{job="shop",handler="/api/checkout",le="0.3"}[{{.window}}])))
total_query: sum(rate(http_request_duration_seconds_count{job="shop",handler="/api/checkout"}[{{.window}}]))
alerting:
name: ShopSlowCheckout
labels:
category: "latency"
annotations:
summary: "Checkout latency SLO burning"
page_alert:
labels:
severity: page
ticket_alert:
labels:
severity: ticket
The latency SLI is the histogram trick spelled out, where the total count minus the 0.3 second bucket gives the number of requests slower than 300 ms. Whatever labels you put under the page and ticket blocks end up on the matching alert. I used severity: page and severity: ticket because those are the values my Alertmanager routes match. Validate the spec before you generate anything from it:
sloth validate -i /etc/sloth/shop.yml
The last line is the one that matters, and it counts one spec file. Validation catches spec mistakes, not PromQL ones, so promtool still gets its turn later.
INFO[0000] SLO period windows loaded svc=alert.WindowsRepo version=v0.16.0 window=30d windows=2
INFO[0000] Plugins loaded k8s-transform-plugins=0 sli-plugins=0 slo-plugins=12 version=v0.16.0 window=30d
INFO[0000] Validation succeeded slo-specs=1 version=v0.16.0 window=30d
Now generate the rule file straight into the directory Prometheus will load. Rerun this after every spec change, since nothing watches the spec for you.
sudo sloth generate -i /etc/sloth/shop.yml -o /etc/prometheus/rules/sloth/shop.yml
On success it prints two log lines and writes the file, and the window=30d field in them shows which SLO period it used. Check that field whenever someone else wrote the spec.
INFO[0000] SLO period windows loaded svc=alert.WindowsRepo version=v0.16.0 window=30d windows=2
INFO[0000] Plugins loaded k8s-transform-plugins=1 sli-plugins=0 slo-plugins=12 version=v0.16.0 window=30d
Thirty days is the default SLO period. If your team reports on four-week cycles instead, there’s a flag for that, and it changes more than the window names.
Reading the rules Sloth generated
Below is the availability half of /etc/prometheus/rules/sloth/shop.yml, exactly as Sloth wrote it. The latency half has the same structure, with the histogram expression and a 0.01 budget in place of these, and its alert rules follow further down:
---
# Code generated by Sloth (v0.16.0): https://github.com/slok/sloth.
# DO NOT EDIT.
groups:
- name: sloth-slo-sli-recordings-shop-requests-availability
rules:
- record: slo:sli_error:ratio_rate5m
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[5m])))
/
(sum(rate(http_requests_total{job="shop"}[5m])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 5m
- record: slo:sli_error:ratio_rate30m
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[30m])))
/
(sum(rate(http_requests_total{job="shop"}[30m])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 30m
- record: slo:sli_error:ratio_rate1h
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[1h])))
/
(sum(rate(http_requests_total{job="shop"}[1h])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 1h
- record: slo:sli_error:ratio_rate2h
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[2h])))
/
(sum(rate(http_requests_total{job="shop"}[2h])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 2h
- record: slo:sli_error:ratio_rate6h
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[6h])))
/
(sum(rate(http_requests_total{job="shop"}[6h])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 6h
- record: slo:sli_error:ratio_rate1d
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[1d])))
/
(sum(rate(http_requests_total{job="shop"}[1d])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 1d
- record: slo:sli_error:ratio_rate3d
expr: |
(sum(rate(http_requests_total{job="shop",code=~"5.."}[3d])))
/
(sum(rate(http_requests_total{job="shop"}[3d])))
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 3d
- record: slo:sli_error:ratio_rate30d
expr: |
sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[30d])
/ ignoring (sloth_window)
count_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[30d])
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
sloth_window: 30d
- name: sloth-slo-meta-recordings-shop-requests-availability
rules:
- record: slo:objective:ratio
expr: vector(0.9990000000000001)
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: slo:error_budget:ratio
expr: vector(1-0.9990000000000001)
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: slo:time_period:days
expr: vector(30)
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: slo:current_burn_rate:ratio
expr: |
slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
/ on(sloth_id, sloth_slo, sloth_service) group_left
slo:error_budget:ratio{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: slo:period_burn_rate:ratio
expr: |
slo:sli_error:ratio_rate30d{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
/ on(sloth_id, sloth_slo, sloth_service) group_left
slo:error_budget:ratio{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: slo:period_error_budget_remaining:ratio
expr: 1 - slo:period_burn_rate:ratio{sloth_id="shop-requests-availability", sloth_service="shop",
sloth_slo="requests-availability"}
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_service: shop
sloth_slo: requests-availability
- record: sloth_slo_info
expr: vector(1)
labels:
owner: payments
sloth_id: shop-requests-availability
sloth_mode: cli-gen-prom
sloth_objective: "99.9"
sloth_service: shop
sloth_slo: requests-availability
sloth_spec: prometheus/v1
sloth_version: v0.16.0
- name: sloth-slo-alerts-shop-requests-availability
rules:
- alert: ShopHighErrorRate
expr: |
(
max(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (14.4 * 0.0009999999999999432)) without (sloth_window)
and
max(slo:sli_error:ratio_rate1h{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (14.4 * 0.0009999999999999432)) without (sloth_window)
)
or
(
max(slo:sli_error:ratio_rate30m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (6 * 0.0009999999999999432)) without (sloth_window)
and
max(slo:sli_error:ratio_rate6h{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (6 * 0.0009999999999999432)) without (sloth_window)
)
labels:
category: availability
severity: page
sloth_severity: page
annotations:
summary: High error rate on the shop service
title: (page) {{$labels.sloth_service}} {{$labels.sloth_slo}} SLO error budget
burn rate is too fast.
- alert: ShopHighErrorRate
expr: |
(
max(slo:sli_error:ratio_rate2h{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (3 * 0.0009999999999999432)) without (sloth_window)
and
max(slo:sli_error:ratio_rate1d{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (3 * 0.0009999999999999432)) without (sloth_window)
)
or
(
max(slo:sli_error:ratio_rate6h{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (1 * 0.0009999999999999432)) without (sloth_window)
and
max(slo:sli_error:ratio_rate3d{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (1 * 0.0009999999999999432)) without (sloth_window)
)
labels:
category: availability
severity: ticket
sloth_severity: ticket
annotations:
summary: High error rate on the shop service
title: (ticket) {{$labels.sloth_service}} {{$labels.sloth_slo}} SLO error budget
burn rate is too fast.
Each SLO gets three rule groups, and once you know which group does what, the file stops looking like a wall:
sli-recordings: 8 rules, one error ratio per windowmeta-recordings: 7 rules the dashboards and the UI readalerts: 2 rules, page and ticket, same alert name
The 30d ratio stood out, because it averages the 5m ratio with sum_over_time instead of running rate() over a month of raw samples. That’s cheaper, but it can only cover as much history as the 5m recording itself has. The alerts have no for: at all, since the short window does the job a for: would, and the budget appears as 0.0009999999999999432, which is just floating point noise from converting 99.9% into a ratio.
The latency alerts matter later, because ShopSlowCheckout is the one that paged during the slow phase. Here are both, page and ticket, from the same generated file. Note the 0.01 budget, which turns the 6x branch into a 0.06 threshold on the 30m and 6h ratios:
- name: sloth-slo-alerts-shop-requests-latency
rules:
- alert: ShopSlowCheckout
expr: |
(
max(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (14.4 * 0.01)) without (sloth_window)
and
max(slo:sli_error:ratio_rate1h{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (14.4 * 0.01)) without (sloth_window)
)
or
(
max(slo:sli_error:ratio_rate30m{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (6 * 0.01)) without (sloth_window)
and
max(slo:sli_error:ratio_rate6h{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (6 * 0.01)) without (sloth_window)
)
labels:
category: latency
severity: page
sloth_severity: page
annotations:
summary: Checkout latency SLO burning
title: (page) {{$labels.sloth_service}} {{$labels.sloth_slo}} SLO error budget
burn rate is too fast.
- alert: ShopSlowCheckout
expr: |
(
max(slo:sli_error:ratio_rate2h{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (3 * 0.01)) without (sloth_window)
and
max(slo:sli_error:ratio_rate1d{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (3 * 0.01)) without (sloth_window)
)
or
(
max(slo:sli_error:ratio_rate6h{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (1 * 0.01)) without (sloth_window)
and
max(slo:sli_error:ratio_rate3d{sloth_id="shop-requests-latency", sloth_service="shop", sloth_slo="requests-latency"} > (1 * 0.01)) without (sloth_window)
)
labels:
category: latency
severity: ticket
sloth_severity: ticket
annotations:
summary: Checkout latency SLO burning
title: (ticket) {{$labels.sloth_service}} {{$labels.sloth_slo}} SLO error budget
burn rate is too fast.
Each alert is two window pairs joined by or, so page fires on either the 14.4x pair or the 6x pair. That is why a moderate slowdown can page through the second branch while the first stays quiet.
To see what the 28-day flag changes, I generated a second copy to a scratch file and diffed it against the 30-day output. Nothing in Prometheus loads the scratch copy.
sloth generate -i /etc/sloth/shop.yml --default-slo-period=28d -o /tmp/shop-28d.yml
diff /etc/prometheus/rules/sloth/shop.yml /tmp/shop-28d.yml | head -30
In the diff, the window becomes 4w, the period record becomes vector(28), and the page factor drops from 14.4 to 13.44. My capture stops at 30 lines, so it only shows the first of the four factors:
86c86
< - record: slo:sli_error:ratio_rate30d
---
> - record: slo:sli_error:ratio_rate4w
88c88
< sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[30d])
---
> sum_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[4w])
90c90
< count_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[30d])
---
> count_over_time(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}[4w])
96c96
< sloth_window: 30d
---
> sloth_window: 4w
114c114
< expr: vector(30)
---
> expr: vector(28)
132c132
< slo:sli_error:ratio_rate30d{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
---
> slo:sli_error:ratio_rate4w{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"}
164c164
< max(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (14.4 * 0.0009999999999999432)) without (sloth_window)
---
> max(slo:sli_error:ratio_rate5m{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (13.44 * 0.0009999999999999432)) without (sloth_window)
166c166
< max(slo:sli_error:ratio_rate1h{sloth_id="shop-requests-availability", sloth_service="shop", sloth_slo="requests-availability"} > (14.4 * 0.0009999999999999432)) without (sloth_window)
I didn’t expect the factor to change, but it makes sense once you do the sums. In both cases the 1h window pages after you’ve burned 2% of the period’s budget, which is 14.4 hours out of 720 or 13.44 out of 672. Sloth’s 28-day window catalog keeps the same budget percentages (2, 5, 10 and 10) as the 30-day one, so every factor rescales the same way: 6 becomes 5.6, 3 becomes 2.8, and 1 becomes about 0.93. If you hand-edit a 30-day file to 28 days and keep the old factors, you’ve moved every threshold without meaning to.
Loading the rules and routing page and ticket
I installed Prometheus and Alertmanager from the release tarballs, the same way as this Prometheus and Alertmanager setup on Linux. The one flag that matters here is --web.enable-lifecycle, because without it POST /-/reload is refused and neither tool’s rules get loaded without a restart or a SIGHUP. This is the unit I ran:
[Unit]
Description=Prometheus
After=network-online.target
[Service]
User=prometheus
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.enable-lifecycle
Restart=on-failure
[Install]
WantedBy=multi-user.target
Beyond that, only the two config files matter for SLOs, so open the Prometheus one first.
sudo vim /etc/prometheus/prometheus.yml
Only the two rule_files globs are SLO-specific here, and Sloth writes .yml while Pyrra writes .yaml, so each tool gets its own glob. Separate directories also mean you can drop one tool later by deleting one folder.
global:
scrape_interval: 15s
evaluation_interval: 30s
alerting:
alertmanagers:
- static_configs:
- targets: ["localhost:9093"]
rule_files:
- /etc/prometheus/rules/sloth/*.yml
- /etc/prometheus/rules/pyrra/*.yaml
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]
- job_name: shop
static_configs:
- targets: ["localhost:8080"]
Alertmanager has to handle two severity vocabularies, because Sloth uses whatever labels you gave it and Pyrra always says critical or warning. A regex matcher on each route covers both.
sudo vim /etc/alertmanager/alertmanager.yml
Grouping on sloth_slo and slo keeps one SLO’s alerts together, and the 10 second group_wait keeps the delivery delay small enough to time. In production I’d raise group_wait back to 30 seconds or more, since a page that waits half a minute costs nothing.
route:
receiver: ticket
group_by: [alertname, sloth_slo, slo]
group_wait: 10s
group_interval: 1m
repeat_interval: 4h
routes:
- receiver: page
matchers:
- severity=~"page|critical"
- receiver: ticket
matchers:
- severity=~"ticket|warning"
receivers:
- name: page
webhook_configs:
- url: http://localhost:5001/page
- name: ticket
webhook_configs:
- url: http://localhost:5001/ticket
There was no PagerDuty in the lab, so both receivers post to a small Python catcher on port 5001. It appends every notification to /var/log/amhook/page.jsonl or ticket.jsonl with a receive timestamp, which is what made the delivery times below measurable. This is where you’d swap in your real receivers.
sudo mkdir -p /opt/amhook /var/log/amhook
sudo vim /opt/amhook/hook.py
It only knows two paths, and anything else gets a 404. Every line it writes holds received_at and the raw Alertmanager payload, so the jq commands later depend on this exact shape.
import datetime
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
class Hook(BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_POST(self):
name = {"/page": "page", "/ticket": "ticket"}.get(self.path)
if not name:
self.send_response(404)
self.end_headers()
return
body = json.loads(self.rfile.read(int(self.headers["Content-Length"])))
line = {"received_at": datetime.datetime.now(datetime.timezone.utc).isoformat(), "payload": body}
with open(f"/var/log/amhook/{name}.jsonl", "a") as f:
f.write(json.dumps(line) + "\n")
self.send_response(200)
self.end_headers()
HTTPServer(("0.0.0.0", 5001), Hook).serve_forever()
Its unit is the same shape as the shop’s. Create it at /etc/systemd/system/amhook.service:
[Unit]
Description=Alertmanager webhook catcher
After=network.target
[Service]
ExecStart=/usr/bin/python3 /opt/amhook/hook.py
Restart=always
[Install]
WantedBy=multi-user.target
Start it and send it a fake notification, then remove the test line so the page log only holds real alerts:
sudo systemctl daemon-reload
sudo systemctl enable --now amhook
curl -s -o /dev/null -w "%{http_code}\n" -X POST -H "Content-Type: application/json" -d "{\"test\":1}" localhost:5001/page
cat /var/log/amhook/page.jsonl
sudo rm /var/log/amhook/page.jsonl
A 200 and one JSON line mean Alertmanager will have somewhere to deliver. The catcher runs as root here, which is fine for a lab and nothing else:
200
{"received_at": "2026-11-12T13:12:20.341638+00:00", "payload": {"test": 1}}
Now check the routing file, which is the part most likely to be wrong:
amtool check-config /etc/alertmanager/alertmanager.yml
Two receivers and a route mean the file parsed the way I meant it to. It doesn’t prove the matchers catch the right alerts, which only the fault run can show. My Alertmanager first started with this final file, but Alertmanager only reads its config at startup, on SIGHUP or on POST /-/reload, so if yours was already running, restart it before going further:
sudo systemctl restart alertmanager
Skip that and the old routes stay in force, and no page or ticket ever reaches the catcher on port 5001.
Checking '/etc/alertmanager/alertmanager.yml' SUCCESS
Found:
- global config
- route
- 0 inhibit rules
- 2 receivers
- 0 templates
Before reloading anything, run promtool over both rule directories. I ran this after Pyrra had written its files too, which is why its two files show up in the result. If you’re following along in order, run the Sloth line now and come back to the Pyrra line after the Pyrra section, because its glob matches nothing yet.
promtool check rules /etc/prometheus/rules/sloth/*.yml
promtool check rules /etc/prometheus/rules/pyrra/*.yaml
Sloth’s single file holds 34 rules, while Pyrra’s two files hold 13 and 15. Every file came back SUCCESS.

So two SLOs cost 34 rules with Sloth and 28 with Pyrra. Now reload Prometheus so it picks them up.
curl -s -X POST localhost:9090/-/reload -w "%{http_code}\n"
A 200 means it accepted the change. Then ask Prometheus which groups it actually loaded:
curl -s localhost:9090/api/v1/rules | jq -r ".data.groups[] | [.file, .name, (.rules|length|tostring)] | @tsv"
Ten groups loaded, with Pyrra’s showing up as one main group and one -increase group for each SLO. Sloth’s six groups are the three per SLO described earlier.
/etc/prometheus/rules/pyrra/shop-availability.yaml shop-availability 11
/etc/prometheus/rules/pyrra/shop-availability.yaml shop-availability-increase 2
/etc/prometheus/rules/pyrra/shop-latency.yaml shop-latency 11
/etc/prometheus/rules/pyrra/shop-latency.yaml shop-latency-increase 4
/etc/prometheus/rules/sloth/shop.yml sloth-slo-alerts-shop-requests-availability 2
/etc/prometheus/rules/sloth/shop.yml sloth-slo-alerts-shop-requests-latency 2
/etc/prometheus/rules/sloth/shop.yml sloth-slo-meta-recordings-shop-requests-availability 7
/etc/prometheus/rules/sloth/shop.yml sloth-slo-meta-recordings-shop-requests-latency 7
/etc/prometheus/rules/sloth/shop.yml sloth-slo-sli-recordings-shop-requests-availability 8
/etc/prometheus/rules/sloth/shop.yml sloth-slo-sli-recordings-shop-requests-latency 8
I’d keep this list as the real check. A rule file can pass promtool and still never load because nobody reloaded Prometheus, and only the API tells you what is actually being evaluated.
Opening the Sloth server UI
Older write-ups say Sloth has no UI, but that’s out of date, because the current release has a sloth server command that reads SLO state straight from Prometheus, and the Sloth site lists the built-in UI as a feature. It defaults to port 8080, which the shop already had, so I moved it.
sudo vim /etc/systemd/system/sloth-server.service
Give the app and status listeners separate ports, and point it at your Prometheus. It needs no access to the spec or the rule files, because everything it shows comes from Sloth’s recordings.
[Unit]
Description=Sloth server
After=network.target
[Service]
ExecStart=/usr/local/bin/sloth server \
--app-listen-address=:8082 \
--status-listen-address=:8083 \
--prometheus-address=http://localhost:9090
Restart=always
[Install]
WantedBy=multi-user.target
Start it and follow the redirect from the root path, since the root itself serves nothing:
sudo systemctl daemon-reload
sudo systemctl enable --now sloth-server
curl -sL -o /dev/null -w "%{http_code} %{url_effective}\n" localhost:8082/
You should land on the services page under /u. A 200 only proves the server is up, so open the page in a browser to check that it actually lists your service.
200 http://localhost:8082/u/app/services
Before the fault, the services page listed the shop service with its two SLOs and nothing burning. Take a look at it now, so you know what calm looks like.

Don’t expect to change anything from it. You still edit the spec and rerun sloth generate, since nothing in the UI writes rules. Only SSH was open to the VM, so I reached the page through a tunnel, and as it has no login, keep it behind a firewall or an authenticating proxy.
Running Pyrra in filesystem mode
Pyrra is usually shown as a Kubernetes operator, but the same binary has a filesystem mode that reads specs from a directory and writes rule files for a plain Prometheus. The project now lives under prometheus-community/pyrra, and its tarball goes through the same checksum step.
PYRRA_VERSION="0.10.2" # pin: version tested in this guide #https://github.com/prometheus-community/pyrra/releases
curl -sLO https://github.com/prometheus-community/pyrra/releases/download/v${PYRRA_VERSION}/pyrra_${PYRRA_VERSION}_Linux_x86_64.tar.gz
curl -sL https://github.com/prometheus-community/pyrra/releases/download/v${PYRRA_VERSION}/checksums.txt -o pyrra.sums
grep Linux_x86_64 pyrra.sums | sha256sum -c -
mkdir -p pyrra && tar xzf pyrra_${PYRRA_VERSION}_Linux_x86_64.tar.gz -C pyrra
sudo install pyrra/pyrra /usr/local/bin/pyrra
Keep the release filename (curl -sLO), because the checksum line looks the tarball up by name. With the name kept, it passes:
pyrra_0.10.2_Linux_x86_64.tar.gz: OK
Pyrra wants one spec per SLO, so start with availability. Its spec format is the same ServiceLevelObjective resource the Kubernetes operator uses.
sudo mkdir -p /etc/pyrra /etc/prometheus/rules/pyrra
sudo vim /etc/pyrra/shop-availability.yaml
Instead of rate expressions, you give it raw metric selectors and it builds the rates itself. That’s less to get wrong, but you also can’t tweak the expression it builds.
apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
name: shop-availability
labels:
prometheus: k8s
role: alert-rules
pyrra.dev/team: payments
spec:
target: "99.9"
window: 30d
description: 99.9% of shop requests succeed (non-5xx).
indicator:
ratio:
errors:
metric: http_requests_total{job="shop",code=~"5.."}
total:
metric: http_requests_total{job="shop"}
A second file holds the latency SLO. It points at the same histogram the Sloth spec used.
sudo vim /etc/pyrra/shop-latency.yaml
Here you name the bucket for the fast requests and the count for all of them, and Pyrra works out the subtraction.
apiVersion: pyrra.dev/v1alpha1
kind: ServiceLevelObjective
metadata:
name: shop-latency
labels:
prometheus: k8s
role: alert-rules
pyrra.dev/team: payments
spec:
target: "99"
window: 30d
description: 99% of checkout requests are faster than 300ms.
indicator:
latency:
success:
metric: http_request_duration_seconds_bucket{job="shop",handler="/api/checkout",le="0.3"}
total:
metric: http_request_duration_seconds_count{job="shop",handler="/api/checkout"}
Labels like prometheus: k8s and role: alert-rules are Kubernetes conventions, and filesystem mode just carries them through to the config view. Pyrra runs as two processes, a filesystem backend that writes rules and an API that serves the UI, so it needs two units, starting with the backend.
sudo vim /etc/systemd/system/pyrra-filesystem.service
Point --prometheus-folder at the directory your rule_files glob already covers. The --config-files glob is where it looks for specs.
[Unit]
Description=Pyrra filesystem backend
After=network.target
[Service]
ExecStart=/usr/local/bin/pyrra filesystem \
--config-files=/etc/pyrra/*.yaml \
--prometheus-folder=/etc/prometheus/rules/pyrra/ \
--prometheus-url=http://localhost:9090
Restart=always
[Install]
WantedBy=multi-user.target
Next comes the API unit, which finds the backend on port 9444.
sudo vim /etc/systemd/system/pyrra-api.service
It serves the UI on 9099 and needs nothing else. Like Sloth’s server, it has no login.
[Unit]
Description=Pyrra API and UI
After=network.target
[Service]
ExecStart=/usr/local/bin/pyrra api \
--prometheus-url=http://localhost:9090 \
--api-url=http://localhost:9444
Restart=always
[Install]
WantedBy=multi-user.target
Start both. I also sent Prometheus a manual reload, for reasons the next paragraph explains:
sudo systemctl daemon-reload
sudo systemctl enable --now pyrra-filesystem pyrra-api
curl -s -X POST localhost:9090/-/reload
The filesystem --help output has no reload flag, so during the run I assumed Pyrra left reloading to me and sent the POST myself before checking the rules API. That assumption was wrong. The v0.10.2 source shows the backend POSTs /-/reload to its --prometheus-url about five seconds after it writes rule files. It logs that only at debug level and logs a warning if it fails, which happens when --web.enable-lifecycle is off. Because I reloaded by hand, my run can’t tell you whether Pyrra’s own reload landed. Keep the manual POST as a cheap check, and look for failed to reload Prometheus in journalctl -u pyrra-filesystem. The backend also logged a namespace must be set warning, which turned out to be harmless outside Kubernetes. Print the generated availability file to see what it wrote.
cat /etc/prometheus/rules/pyrra/shop-availability.yaml
Pyrra wrote all 13 rules with no changes from me. Compare the window names with Sloth’s as you read:
groups:
- interval: 2m30s
name: shop-availability-increase
rules:
- expr: sum by (code) (increase(http_requests_total{job="shop"}[30d]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:increase30d
- alert: SLOMetricAbsent
expr: absent(http_requests_total{job="shop"}) == 1
for: 3m
labels:
job: shop
severity: critical
slo: shop-availability
team: payments
- interval: 30s
name: shop-availability
rules:
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[5m])) / sum(rate(http_requests_total{job="shop"}[5m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate5m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[32m])) / sum(rate(http_requests_total{job="shop"}[32m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate32m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[1h4m])) / sum(rate(http_requests_total{job="shop"}[1h4m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate1h4m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[2h9m])) / sum(rate(http_requests_total{job="shop"}[2h9m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate2h9m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[6h26m])) / sum(rate(http_requests_total{job="shop"}[6h26m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate6h26m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[1d1h43m])) / sum(rate(http_requests_total{job="shop"}[1d1h43m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate1d1h43m
- expr: sum(rate(http_requests_total{code=~"5..",job="shop"}[4d6h51m])) / sum(rate(http_requests_total{job="shop"}[4d6h51m]))
labels:
job: shop
slo: shop-availability
team: payments
record: http_requests:burnrate4d6h51m
- alert: ErrorBudgetBurn
expr: http_requests:burnrate5m{job="shop",slo="shop-availability"} > (14 * (1-0.9990000000000001))
and http_requests:burnrate1h4m{job="shop",slo="shop-availability"} > (14 * (1-0.9990000000000001))
for: 2m0s
labels:
exhaustion: 2d3h25m42s
job: shop
long: 1h4m
severity: critical
short: 5m
slo: shop-availability
team: payments
- alert: ErrorBudgetBurn
expr: http_requests:burnrate32m{job="shop",slo="shop-availability"} > (7 * (1-0.9990000000000001))
and http_requests:burnrate6h26m{job="shop",slo="shop-availability"} > (7 * (1-0.9990000000000001))
for: 16m0s
labels:
exhaustion: 4d6h51m25s
job: shop
long: 6h26m
severity: critical
short: 32m
slo: shop-availability
team: payments
- alert: ErrorBudgetBurn
expr: http_requests:burnrate2h9m{job="shop",slo="shop-availability"} > (2 * (1-0.9990000000000001))
and http_requests:burnrate1d1h43m{job="shop",slo="shop-availability"} > (2 *
(1-0.9990000000000001))
for: 1h4m0s
labels:
exhaustion: 15d
job: shop
long: 1d1h43m
severity: warning
short: 2h9m
slo: shop-availability
team: payments
- alert: ErrorBudgetBurn
expr: http_requests:burnrate6h26m{job="shop",slo="shop-availability"} > (1 * (1-0.9990000000000001))
and http_requests:burnrate4d6h51m{job="shop",slo="shop-availability"} > (1 *
(1-0.9990000000000001))
for: 3h13m0s
labels:
exhaustion: 30d
job: shop
long: 4d6h51m
severity: warning
short: 6h26m
slo: shop-availability
team: payments
Of those, 8 are recording rules (seven burn-rate windows plus a 30-day increase) and 5 are alerts (four ErrorBudgetBurn and one SLOMetricAbsent). The 30-day increase runs in its own group every 2m30s instead of every 30 seconds, which I read as Pyrra keeping its most expensive query off the hot path. Recording rule names come from the metric, such as http_requests:burnrate5m, rather than from a shared slo: namespace the way Sloth’s do.
From the success and total metrics, the latency file got the same count-minus-bucket expression I wrote by hand for Sloth:
- interval: 30s
name: shop-latency
rules:
- expr: (sum(rate(http_request_duration_seconds_count{handler="/api/checkout",job="shop"}[5m]))
- sum(rate(http_request_duration_seconds_bucket{handler="/api/checkout",job="shop",le="0.3"}[5m])))
/ sum(rate(http_request_duration_seconds_count{handler="/api/checkout",job="shop"}[5m]))
labels:
handler: /api/checkout
job: shop
slo: shop-latency
team: payments
record: http_request_duration_seconds:burnrate5m
The four latency alerts are the same ErrorBudgetBurn shape against a 0.01 budget, so the second critical needs the 32m and 6h26m ratios above 0.07 for a full 16 minutes:
- alert: ErrorBudgetBurn
expr: http_request_duration_seconds:burnrate5m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (14 * (1-0.99)) and http_request_duration_seconds:burnrate1h4m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (14 * (1-0.99))
for: 2m
labels:
exhaustion: 2d3h25m42s
handler: /api/checkout
job: shop
long: 1h4m
severity: critical
short: 5m
slo: shop-latency
team: payments
- alert: ErrorBudgetBurn
expr: http_request_duration_seconds:burnrate32m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (7 * (1-0.99)) and http_request_duration_seconds:burnrate6h26m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (7 * (1-0.99))
for: 16m
labels:
exhaustion: 4d6h51m25s
handler: /api/checkout
job: shop
long: 6h26m
severity: critical
short: 32m
slo: shop-latency
team: payments
- alert: ErrorBudgetBurn
expr: http_request_duration_seconds:burnrate2h9m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (2 * (1-0.99)) and http_request_duration_seconds:burnrate1d1h43m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (2 * (1-0.99))
for: 1h4m
labels:
exhaustion: 15d
handler: /api/checkout
job: shop
long: 1d1h43m
severity: warning
short: 2h9m
slo: shop-latency
team: payments
- alert: ErrorBudgetBurn
expr: http_request_duration_seconds:burnrate6h26m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (1 * (1-0.99)) and http_request_duration_seconds:burnrate4d6h51m{handler="/api/checkout",job="shop",slo="shop-latency"}
> (1 * (1-0.99))
for: 3h13m
labels:
exhaustion: 30d
handler: /api/checkout
job: shop
long: 4d6h51m
severity: warning
short: 6h26m
slo: shop-latency
team: payments
The latency file also carries two SLOMetricAbsent alerts, one for the histogram count and one for the 0.3 bucket, each with for: 11m, inside a shop-latency-increase group that holds two 30-day increases instead of one. The six burn-rate recordings I left out repeat the 5m expression above with the other windows, which brings the latency file to 15 rules.
Pyrra’s UI on port 9099 listed both SLOs at a full budget before the fault. I didn’t dig into how the UI computes 100% while the availability burn-rate series was still empty, so read that tile as “no errors seen yet” rather than as proof the rules work.

Where do numbers like 1h4m come from? As far as I can tell, Pyrra scales its windows from the 30-day period instead of using the workbook’s round numbers. These are the ones it derived for my SLOs, read from the loaded alert rules.
| Short / long window | Factor | for: | Severity | Exhaustion label |
|---|---|---|---|---|
| 5m / 1h4m | 14 | 2m | critical | 2d3h25m42s |
| 32m / 6h26m | 7 | 16m | critical | 4d6h51m25s |
| 2h9m / 1d1h43m | 2 | 1h4m | warning | 15d |
| 6h26m / 4d6h51m | 1 | 3h13m | warning | 30d |
I liked the exhaustion label, because an on-call engineer sees how long the budget lasts at that rate without doing the arithmetic. Keep an eye on the 16 minute for: on the second critical alert, since it’s the one that paged me late.
Breaking the shop on purpose
A small shell loop polled every few seconds and appended one line per poll to a timeline file. Most alert times below are Prometheus startsAt values or webhook receive times, and the two that are poll observations (13:28:19 and 13:34:31) are only accurate to within ten seconds or so. Each line held:
- The current fault word
- Every Prometheus
ALERTSseries and its state - What the Alertmanager API held
- Line counts of the page and ticket webhook logs
With the loop running, I flipped the fault file, first to errors and later to slow responses:
echo errors | sudo tee /etc/shop/fault
echo slow | sudo tee /etc/shop/fault
echo off | sudo tee /etc/shop/fault
One caveat changes how you should read the times below. Prometheus started at 13:05:20 UTC, so at 13:15:56, when I set the errors fault, it held about ten and a half minutes of samples. Windows of 1h, 6h and 3d were effectively the length of the series’ life, which made every long window react much faster than it would on a box with weeks of history. The table lists what happened, in UTC on 12 November 2026.
| Time | Event |
|---|---|
| 13:15:56 | Fault set to errors (30% 500s) |
| 13:17:13 | Sloth ShopHighErrorRate page and ticket start firing, 77 s after the fault |
| 13:17:23 | Both arrive at the webhook (10 s group_wait) |
| 13:18:46 | Pyrra ErrorBudgetBurn critical, short 5m, firing after its 2m for: |
| 13:23:06 | Fault set to slow, errors stop |
| 13:25:18 | Sloth ShopSlowCheckout ticket |
| 13:28:56 | Resolved notice for Pyrra’s 5m critical delivered (the alert had left ALERTS by the 13:28:19 poll); Sloth’s availability page keeps firing on its 30m/6h branch |
| 13:32:46 | Pyrra availability critical, short 32m, fires nearly 10 minutes after the last 500 |
| 13:32:48 | Sloth ShopSlowCheckout page |
| 13:34:31 | Pyrra latency critical (32m) still only pending |
| 13:34:40 | Fault set to off |
Sloth paged first in both cases, and the 77 seconds says more about the young database than about Sloth. On a box with an hour of clean history, a 30% error rate needs 0.0144 / 0.3 × 60 ≈ 2.9 minutes to push the 1h window over 14.4x. That’s arithmetic, not a measurement, and the same sum for Pyrra’s 1h4m window plus its 2m for: puts its first page at roughly five minutes. The page receiver’s log tells the story of what really arrived:
jq -r "[.received_at[11:19], .payload.status, .payload.alerts[0].labels.alertname, .payload.alerts[0].labels.severity, .payload.alerts[0].labels.short // \"-\"] | @tsv" /var/log/amhook/page.jsonl
Six notifications reached the page receiver during the run. Each line is one webhook POST, not one alert, because Alertmanager batches a group into one payload.
13:17:23 firing ShopHighErrorRate page -
13:18:56 firing ErrorBudgetBurn critical 5m
13:28:56 resolved ErrorBudgetBurn critical 5m
13:32:56 firing ErrorBudgetBurn critical 32m
13:32:58 firing ShopSlowCheckout page -
13:34:56 firing ErrorBudgetBurn critical 5m
I stared at the last line for a minute, because it reads firing ... 5m at 13:34:56, long after the 5m alert resolved. Printing every alert in each payload showed it’s an Alertmanager group update. The availability group held the resolved 5m alert and the newly firing 32m alert together, and alerts[0] happened to be the resolved one.

If your pager integration only reads the first alert in a payload, it will mislabel these updates, so read the whole alerts array. During the errors phase, Alertmanager’s alerts page showed both tools’ pages under the page receiver:

- 1Pyrra critical
- 2Sloth page
- 3Sloth ticket
Pyrra critical (1) is the ErrorBudgetBurn alert routed by severity=critical. Sloth page (2) is ShopHighErrorRate under the same receiver, and Sloth ticket (3) is its twin, routed to the ticket receiver. One Alertmanager config handled both vocabularies cleanly, which was my main worry before the run.
In Pyrra, open the SLO and scroll down to the Multi Burn Rate Alerts table. It shows all four alerts at once, with their live burn values:

- 1Firing
- 2Short burn
- 3for: 2m
In the table, the row marked Firing (1) is the 5m/1h4m critical. The Short burn cell (2) shows the 5m error ratio far above the 0.014 threshold, and for: 2m (3) is the wait it served before firing. The rows under it sat in pending, so this table is the fastest way to see which alert will fire next.
Where the two tools really disagreed was the latency phase. At 13:32:48 Sloth’s latency page fired with a 5m error ratio of 0.2446 and a 1h ratio of 0.0627. Since the 1h ratio was nowhere near the 14.4x line (0.144), the page came from the 30m/6h branch at 6x (0.06). Pyrra’s equivalent alert uses 7x (0.07) over 32m/6h26m. It crossed that line and showed as pending at the 13:34:31 poll, about a minute and three quarters after Sloth paged, and then its 16 minute for: still stood between it and a page when I switched the fault off nine seconds later. Same SLO, same data, and only one tool paged, partly because of the higher factor and mostly because of the for:.

Captured during the errors phase, the Sloth UI shows requests-availability burning at 23168.59% with a remaining budget of -13479.25%. Those numbers look absurd because the 30-day denominator only covered minutes, and on a long-running Prometheus they’d read as a few percent per incident.
Watching the error budget drain in Grafana
Sloth’s meta recordings are what the community dashboards read: 14348 (SLO / Detail) and 14643 (High level Sloth SLOs). I installed Grafana from its package, as in the Prometheus and Grafana server monitoring guide, and then provisioned both dashboards from files. For where these dashboards sit next to traces and logs, see the open-source observability and SLO stack this post belongs to.
for id in 14348 14643; do curl -sL https://grafana.com/api/dashboards/$id/revisions/latest/download -o d$id.json; done
sed -i "s/\${DS_PROMETHEUS}/prometheus/g" d14348.json d14643.json
sudo mkdir -p /var/lib/grafana/dashboards
sudo cp d14348.json d14643.json /var/lib/grafana/dashboards/
sudo chown -R grafana: /var/lib/grafana/dashboards
With the sed, the import-time datasource variable becomes prometheus, which is the uid I gave the provisioned datasource. If the two don’t match, the panels can’t find their datasource, so keep them in step. Next comes the dashboard provider.
sudo vim /etc/grafana/provisioning/dashboards/sloth.yml
Grafana loads every JSON file in that directory through this provider. Dropping a new dashboard file in there is all it takes to add one.
apiVersion: 1
providers:
- name: sloth
type: file
options:
path: /var/lib/grafana/dashboards
Give the datasource a fixed uid in its own provisioning file. Without one, Grafana generates a random uid and the dashboards can’t refer to it by name.
sudo vim /etc/grafana/provisioning/datasources/prometheus.yml
Notice the uid: prometheus line, because the sed above relies on it.
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://localhost:9090
isDefault: true
Restart Grafana and give it about 30 seconds before you query it, since on first start my API calls came back empty while it was still migrating its database:
sudo systemctl restart grafana-server
curl -s -u admin:'StrongPass' localhost:3000/api/search | jq -r ".[] | [.uid,.title,.type] | @tsv"
Swap StrongPass for your own admin password, or plain admin if you haven’t logged in yet, since a fresh package install starts as admin/admin; a wrong password returns a 401 and jq fails on it. Both dashboards were registered under predictable uids. Those uids come from the JSON files, so links to them survive a rebuild.
high-level-sloth-slos High level Sloth SLOs dash-db
slo-detail SLO / Detail dash-db
During the errors phase, SLO / Detail for the availability SLO looked like this. I turned on anonymous Viewer access only to take the screenshot, so leave it off on a real Grafana.

At that moment the dashboard showed a current burn of 31421% of budget, a remaining 30-day budget of -20314%, and both the warning and critical alert panels FIRING, with the burn-rate graph sitting around 300x. The dashboard reads nothing but the recording rules Sloth generated, so you don’t write any PromQL to get an error budget dashboard. That’s the strongest practical argument for Sloth that I found.
Pyrra doesn’t need Grafana for this view, since its detail page shows the objective, availability and remaining budget at the top:

At capture time it read 93.550% availability from 1,034 errors out of 16,041 requests, against a 99.900% objective, with an error budget of -6350.166%. It’s the same short-history distortion as in Sloth, from a different formula. Pyrra also has a --generic-rules flag for its own Grafana dashboards, which I did not try.
Sloth vs Pyrra: what the lab showed
Every row below comes from the files and runs above, not from either project’s feature list:
| What I measured | Sloth | Pyrra |
|---|---|---|
| Rules for my two SLOs | 34 (30 recording, 4 alerting), one file | 28 (17 recording, 11 alerting), one file per SLO |
| Alert names | Yours, from the spec (ShopHighErrorRate, ShopSlowCheckout) | Always ErrorBudgetBurn, told apart by slo, short, long |
| Severity labels | Whatever you set (page, ticket) | Fixed critical, warning |
| Windows and factors | 5m/1h, 30m/6h, 2h/1d, 6h/3d at 14.4, 6, 3, 1 | 5m/1h4m, 32m/6h26m, 2h9m/1d1h43m, 6h26m/4d6h51m at 14, 7, 2, 1 |
for: on alerts | None | 2m, 16m, 1h4m, 3h13m |
| Missing-metric alert | No | Yes, SLOMetricAbsent |
| First availability page in my run | 77 s after the fault | 2 min 50 s after the fault |
| Latency page in my run | Fired (6x branch) | Still pending at 7x |
| UI | sloth server, read-only, one extra process | pyrra api, read-only, with an alerts table and exhaustion times |
| Setup effort | One static binary, one spec file, one sloth generate command and a Prometheus reload, plus one systemd unit if you want the UI | One tarball, one spec file per SLO (two here), two systemd units (filesystem backend and API), plus the manual reload I sent during the run |
| Running processes | None for rules (CLI); one for the UI | Two (filesystem backend plus API) |
| Prometheus reload | Yours, after each generate | The backend POSTs /-/reload itself (per its source); I reloaded by hand anyway |
| Kubernetes needed | No | No (filesystem mode) |
| Error budget dashboard | Community dashboards 14348 and 14643 worked as soon as they were provisioned | Built into the UI |
So which would I run on a plain Prometheus today? Sloth, mostly because owning the alert names and severity labels means it fits the routing you already have. A generate step in CI produces a reviewable diff, and the Grafana dashboards needed no work at all. I’d pick Pyrra when the people reading SLOs aren’t the people writing PromQL, because its UI answers “how long until the budget’s gone” better than anything I set up for Sloth. Before trusting either, look hard at the 16 minute for: on Pyrra’s second critical, because in my run it paged ten minutes after the errors had stopped.
If uptime from the outside matters more to you than request SLIs, a Blackbox exporter probe gives you a probe_success series to build an availability SLI from, though I didn’t wire one into either tool here. Host-level availability works the same way, as in this Linux server uptime setup with Prometheus and Grafana.
Troubleshooting what broke in the lab
All but one of these came up in the lab, each with the fix that worked. Two of them are plain file permissions, which tells you more about how I copied files than about either tool. The Pyrra reload entry is a failure mode I didn’t hit, but it’s the first thing I’d check if Pyrra’s alerts never showed up.
pyrra_0.10.2_Linux_x86_64.tar.gz: FAILED open or read
My first download saved the tarball under a shorter local name, and sha256sum -c looks for the exact filename listed in checksums.txt. Download with curl -sLO so the release name is kept, then rerun the check. It isn’t a corrupt file, so there’s no need to fetch it again from somewhere else.
amtool check-config: open /etc/alertmanager/alertmanager.yml: permission denied
I’d copied the config in with a 0600 mode owned by the alertmanager user, so my login user couldn’t read it, even though Alertmanager itself was fine. Running sudo chmod 644 /etc/alertmanager/alertmanager.yml fixed it, and running amtool with sudo works too.
sloth validate: could not read SLOs spec file data: permission denied
Sloth failed for the same reason, since the spec had arrived as a root-owned 0600 file. Run sudo chmod 644 /etc/sloth/shop.yml. The full error reads error: "validate" command failed: could not read SLOs spec file data: open /etc/sloth/shop.yml: permission denied, and the useful part is at the end.
Availability SLO has no data before the first 500
At baseline, slo:sli_error:ratio_rate5m only returned the latency SLO, and Pyrra’s http_requests:burnrate5m was empty for availability. The error query matches a series that doesn’t exist until a 500 has been served, and you can see it directly:
curl -s localhost:9090/api/v1/query --data-urlencode "query=sum(rate(http_requests_total{job=\"shop\",code=~\"5..\"}[5m]))" | jq -c ".data.result"
curl -s localhost:9090/api/v1/query --data-urlencode "query=sum(rate(http_requests_total{job=\"shop\",code=~\"5..\"}[5m])) or vector(0)" | jq -c ".data.result"
Run alone, the first query returns an empty vector, while adding or vector(0) turns it into a real zero.
[]
[{"metric":{},"value":[1794489126.040,"0"]}]
I left the spec unchanged for the run, and the alerts still fired as soon as errors appeared. But the dashboards show “No data” instead of 100% on a healthy service, and a broken scrape looks exactly the same. Add or vector(0) to Sloth’s error_query, and let Pyrra’s SLOMetricAbsent cover the broken-scrape half on its side.
Pyrra shows the SLOs but Prometheus has no Pyrra rules
Pyrra’s backend tries to reload Prometheus itself after writing rules, but that POST fails without --web.enable-lifecycle, and the failure only shows up as a failed to reload Prometheus warning in journalctl -u pyrra-filesystem. Run curl -s -X POST localhost:9090/-/reload or send Prometheus a SIGHUP, then confirm with the /api/v1/rules query from earlier. A spec that changes without a working reload leaves the old alert thresholds in force, and the Pyrra UI won’t tell you.
Grafana API returns nothing right after the first start
Fifteen seconds after systemctl enable --now grafana-server, /api/search returned nothing because the connection wasn’t accepted yet, and a second try a little later listed both dashboards. If you script this, poll /api/health until it reports "database": "ok" instead of sleeping for a fixed time. Running Grafana outside a package is covered in this Grafana in Docker guide.
What I still don’t know
My lab answered the question I started with, but it left a few open, mostly because a fresh Prometheus cannot stand in for one with a month of history:
- Reset times: my poller stopped at 13:34:46, before anything resolved
- Mature-history timings: my 2.9 minute figure is arithmetic, not a run
- Pyrra’s
--generic-rulesGrafana dashboards: not tried - Either tool’s Kubernetes mode: I have not tested it
Reset time is the one I’d measure next. Sloth’s availability page was still firing on its 30m/6h branch more than eleven minutes after the last 500, and Pyrra’s 32m alert had only just started. On a real pager, how long an alert keeps firing after the fix matters as much as how soon it fires, and I don’t have that number for either tool yet. The same counter and histogram pattern works for databases too, and the metrics in this QuestDB monitoring setup with Prometheus are where I’d look for a second service to put SLOs on.