Skip to main content

Module slo

Module slo 

Source
Expand description

SLO schema, breach detection, and safe-mode enforcement (bd-2xj.2).

Provides machine-readable SLO definitions with data-plane and decision-plane budgets. Integrates with the metrics registry (BuiltinCounter::SloBreachesTotal) and structured tracing (slo.check span).

§Architecture

slo.yaml  ──parse──▶  SloSchema
                         │
        observations ──▶ check_breach() ──▶ BreachResult
                                              │
                         batch ──▶ check_safe_mode() ──▶ SafeModeDecision
                                                           │
                                  emit_slo_check() ──▶ tracing span + event

§Tracing contract

  • Span: slo.check with fields metric_name, metric_type, baseline, current, ratio, severity.
  • WARN event for breach, ERROR event for safe-mode trigger.
  • METRICS: ftui_slo_breaches_total counter incremented on breach.

Structs§

BreachResult
Result of a breach check for a single metric.
MetricSlo
Per-metric SLO definition.
SloSchema
Validated SLO configuration parsed from slo.yaml.

Enums§

BreachSeverity
Severity of a detected breach.
MetricType
Metric type for SLO enforcement.
SafeModeDecision
Safe-mode decision from batch breach evaluation.
SloSchemaError
Schema validation error.

Functions§

check_breach
Check a single metric observation against its SLO.
check_safe_mode
Evaluate safe-mode trigger from a batch of breach results.
emit_slo_check
Emit a tracing span for SLO check and log appropriate events.
parse_slo_yaml
Parse and validate slo.yaml content.
run_slo_check
Run a full SLO check batch: parse schema, check all metrics, evaluate safe-mode.