Skip to content

Latest commit

 

History

History
132 lines (96 loc) · 4.22 KB

slos.md

File metadata and controls

132 lines (96 loc) · 4.22 KB

SLOs

Service Level Objectives (SLOs) define reliability targets for your services. dtctl lets you list, create, evaluate, and manage SLOs directly from the command line, including starting from a built-in template.

dtctl docs / Resources / SLOs

Supported operations

Operation Resource Command syntax Description Mutating Access
create slo dtctl create slo Create resources from files yes write
delete slo dtctl delete slo Delete resources yes delete
describe slo dtctl describe slo Show details of a specific resource no read
exec slo dtctl exec slo Execute workflows, functions, analyzers, SLOs, and code-level profiling no run
get slos dtctl get slos Display one or many resources no read
get slo-templates dtctl get slo-templates Display one or many resources no read

Flags

These commands take dtctl's global flags (-o/--output, --context, --jq, -v, and more). Some verbs add their own flags (apply, diff, query, inventory); see the verb in COMMANDS.md. Individual commands may take further flags of their own — run dtctl <verb> <resource> --help for the authoritative list.

Required token scopes

Safety level Scopes
read slo:objective-templates:read, slo:slos:read
run slo:slos:read
write slo:slos:write

Output

get slos prints a compact table by default; -o wide adds target, warning, and current status columns. describe slo shows full details for one SLO, including its current status, error budget, and evaluation configuration. exec slo (evaluation) returns the current SLO value, error budget remaining, and evaluation status.

Examples

# List all SLOs
dtctl get slos

# Filter by name
dtctl get slos --filter "name contains 'production'"

# Wide output with target, warning, and current status
dtctl get slos -o wide

# JSON for scripting
dtctl get slos -o json

Describe a specific SLO:

dtctl describe slo slo-123

Use a built-in template as a starting point, or define SLOs in YAML directly:

# List available SLO templates
dtctl get slo-templates

# Create (fails if the SLO already exists)
dtctl create slo -f slo.yaml

# Apply (creates if new, updates if existing)
dtctl apply -f slo.yaml

Trigger an on-demand evaluation to check the current status and remaining error budget:

dtctl exec slo slo-123

This returns output like:

Name:           Checkout Availability
Status:         SUCCESS
SLO Value:      99.94%
Target:         99.90%
Warning:        99.95%
Error Budget:   0.04% remaining
Timeframe:      last 7 days

Delete an SLO (dtctl prompts for confirmation in interactive mode; use --plain to skip it in CI):

dtctl delete slo slo-123

Notes

SLO definition fields

Field Description
evaluationType AGGREGATE (single value over the timeframe) or PER_INTERVAL (evaluated per interval)
target The SLO target percentage (for example, 99.9)
warning Warning threshold. Alerts before the target is breached
filter Entity selector to scope the SLO
metricExpression Metric expression that computes the SLO value
timeframe Evaluation window (for example, -1w, -30d)

Example SLO YAML with a custom SLI

name: Service Availability
description: 97% of requests are successful over the last 7 days
criteria:
  - timeframeFrom: -7d
    target: 97.0
    warning: 98.0
customSli:
  indicator: |
    timeseries { total=sum(dt.service.request.count), failures=sum(dt.service.request.failure_count) }
    , by: { dt.smartscape.service }
    | fieldsAdd sli=(((total[]-failures[])/total[])*(100))
    | fieldsAdd dt.smartscape.entity.name = getNodeName(dt.smartscape.service)
    | fieldsRemove total, failures, smartscapeIds
tags:
  - slo-type:availability