ktm metrics slo
Compute SLI/SLO metrics using Google SRE burn-rate methodology
Compute SLI/SLO metrics using Google SRE burn-rate methodology
Usage
ktm metrics slo [flags]
Examples
# Compute SLO for 99.9% target over 30-day window
ktm metrics slo --operator acme \
--query "SELECT sum(good) AS good, sum(total) AS total FROM test WHERE time > now() - 30d" \
--slo-target 99.9
# Custom field names and 7-day window
ktm metrics slo --operator acme \
--query "SELECT sum(success) AS ok, sum(requests) AS all_req FROM api WHERE time > now() - 7d" \
--slo-target 99.5 --good-field ok --total-field all_req --window 7d
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--good-field | string | good | Field name for good events |
--operator | string | Operator slug (= InfluxDB database name) | |
--precision | string | Query time precision (s, ms, u, ns) | |
--query | string | InfluxQL query returning good/total fields | |
--slo-target | float | SLO target percentage (e.g. 99.9) | |
--total-field | string | total | Field name for total events |
--window | string | 30d | SLO window (e.g. 30d, 168h) |
Details
Compute SLI/SLO metrics from InfluxDB query results.
Prerequisite: Discover available measurements and fields first using 'metrics query --operator <slug> --query "SHOW MEASUREMENTS"' and 'metrics query --operator <slug> --query "SHOW FIELD KEYS FROM <measurement>"'. Do not fabricate measurement or field names.
Run an InfluxQL query that returns good and total event counts (e.g., SELECT sum(good) AS good, sum(total) AS total FROM ...). The tool extracts good/total fields, computes SLI, error budget, burn rate, and severity.
Severity thresholds (Google SRE):
- critical: burn rate > 14.4x (page immediately)
- red: burn rate > 6x (create ticket)
- yellow: burn rate > 1x (SLO at risk)
- green: burn rate <= 1x (within budget)
Related
Global flags (--output, --debug, --host, …) apply to every command. See the command reference overview.
What's next?
Last updated on