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

FlagTypeDefaultDescription
--good-fieldstringgoodField name for good events
--operatorstringOperator slug (= InfluxDB database name)
--precisionstringQuery time precision (s, ms, u, ns)
--querystringInfluxQL query returning good/total fields
--slo-targetfloatSLO target percentage (e.g. 99.9)
--total-fieldstringtotalField name for total events
--windowstring30dSLO 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)

Global flags (--output, --debug, --host, …) apply to every command. See the command reference overview.

What's next?

All commands

Browse the full CLI reference.

Get started

Install the CLI and authenticate.

Last updated on