sloak is a command-line tool designed to simplify Service Level Objective (SLO) engineering. It provides utilities for calculating error budgets, burn rates, feasibility, and more, helping SREs and developers build more reliable systems.
Inspired by the Google SRE Workbook.
AI was used in the form of the Antigravity IDE with the Gemini LLM to speed up coding. The LLM was guided into using desired frameworks in an exploratory manner, had to follow general golang standards as well as clean architecture. If you want to re-use this or build from it I advice you to review thouroughly.
The easiest way to start is by calculating an error budget for a standard SLO.
# Calculate 99.9% SLO over 30 days
sloak calculate errorbudget --slo 99.9 --window 30d
# Get machine-readable JSON for Prometheus/Automation
sloak calculate errorbudget --slo 99.9 --window 30d --output jsonSLOAK supports file-based configuration and environment variables to set team-wide global defaults (like your SLO, time window, MTTR, etc).
To generate a starting configuration template, simply run:
sloak init > .sloak.yamlOnce .sloak.yaml is placed in your home directory or current working directory (or using SLOAK_ prefixed environment variables like SLOAK_SLO=95.0), you can omit those flags!
# Automatically uses 'slo' and 'window' from your config
sloak calculate errorbudget- Calculate Burn Rate: See how fast you're consuming your budget.
sloak calculate burnrate --slo 99.9 --window 30d --elapsed 7d --consumed 30m
- Feasibility Analysis: Check if your MTTR is realistic for your SLO.
sloak calculate feasibility --slo 99.9 --mttr 1h
- Max Disruption: Calculate how many deployments you can afford.
sloak calculate max-disruption --slo 99.9 --cost 2m
- Template Rendering: Render observability configs from BYOT templates (Prometheus Operator, Datadog, etc).
sloak render --template ./templates/prometheus_operator_mwmbr.cue --slo 99.9 --set metric_name=checkout_flow --set namespace=billing
# Clone the repository
git clone https://github.com/MichielVanderhoydonck/sloak.git
cd sloak
# Build the binary
go build -o sloak cmd/sloak/main.go
# (Optional) Install to your GOBIN
go install ./cmd/sloak| Command | Description |
|---|---|
init |
Prints a default .sloak.yaml configuration template. |
calculate errorbudget |
Allowed failure time for a given SLO and window. |
calculate burnrate |
Current budget consumption speed and exhaustion forecast. |
calculate feasibility |
Required MTBF given a target SLO and MTTR. |
calculate dependency |
Composite availability for serial/parallel systems. |
calculate max-disruption |
Frequency limits based on deployment disruption cost. |
convert |
Translate between availability % and downtime duration. |
generate alert-table |
Generate a standard multi-window, multi-burn-rate alert table. |
render |
Render observability rules using a BYOT CUE template. |
--config string: Override the path to the configuration file (default is$HOME/.sloak.yamlor./.sloak.yaml).-o, --output string: Set output format. Usejsonfor machine-readable data (useful for Prometheus alerting config).
sloak follows Clean Architecture principles:
- Domain (
internal/domain): Core business rules and interfaces (Service). Depends on nothing. - Service (
internal/service): Concrete implementation of domain logic. Depends onDomain. - CLI Commands (
cmd/convert, etc.): Delivery mechanism. Depends only onDomain. They are strictly prohibited from importing packageinternal/service. - Composition Root (
cmd/root.go,cmd/sloak/main.go): Bootstrap layer. Allowed to import bothcmdandinternal/serviceto wire concrete services to commands via dependency injection.
We use go-arch-lint to enforce these architectural boundaries.
docker run --rm -v ${PWD}:/app fe3dback/go-arch-lint:latest check --project-path /appgo test ./...Verified against the actual compiled binary.
go test -v -tags=e2e ./test/e2e