lightspeed/ops/slo_autopilot

SLO burn-rate and mitigation-control contracts for M30.

Types

One audit trail entry for mitigation actions.

pub type AuditEntry {
  AuditEntry(
    actor_id: String,
    control: Control,
    decision: Decision,
    reason: String,
    at_ms: Int,
    status: Status,
  )
}

Constructors

  • AuditEntry(
      actor_id: String,
      control: Control,
      decision: Decision,
      reason: String,
      at_ms: Int,
      status: Status,
    )

Burn-rate observation for one service/SLO target.

pub type BurnRateSample {
  BurnRateSample(
    service: String,
    slo_name: String,
    short_window_milli: Int,
    long_window_milli: Int,
    hotspot_tenant_id: String,
  )
}

Constructors

  • BurnRateSample(
      service: String,
      slo_name: String,
      short_window_milli: Int,
      long_window_milli: Int,
      hotspot_tenant_id: String,
    )

Mitigation controls managed by the autopilot runtime.

pub type Control {
  ShedEvents(percent: Int)
  PauseBackgroundJobs
  IsolateHotspotTenant(tenant_id: String)
  EnterReadOnlyMode
}

Constructors

  • ShedEvents(percent: Int)
  • PauseBackgroundJobs
  • IsolateHotspotTenant(tenant_id: String)
  • EnterReadOnlyMode

Auditable runtime decision.

pub type Decision {
  Applied
  RolledBack
  Noop(reason: String)
}

Constructors

  • Applied
  • RolledBack
  • Noop(reason: String)

Runtime

opaque

SLO autopilot runtime.

pub opaque type Runtime

Burn-rate status classification.

pub type Status {
  Healthy
  Warning
  Critical
}

Constructors

  • Healthy
  • Warning
  • Critical

Threshold profile for burn-rate evaluation.

pub type Thresholds {
  Thresholds(
    warn_short_milli: Int,
    warn_long_milli: Int,
    critical_short_milli: Int,
    critical_long_milli: Int,
  )
}

Constructors

  • Thresholds(
      warn_short_milli: Int,
      warn_long_milli: Int,
      critical_short_milli: Int,
      critical_long_milli: Int,
    )

Values

pub fn active_controls(runtime: Runtime) -> List(Control)

Active controls in stable order.

pub fn apply(
  runtime: Runtime,
  control: Control,
  actor_id: String,
  reason: String,
  at_ms: Int,
  status: Status,
) -> Runtime

Apply one control with an audit trail entry.

pub fn audit_entries(runtime: Runtime) -> List(AuditEntry)

Audit entries in stable order.

pub fn audit_label(entry: AuditEntry) -> String

Stable audit-entry label.

pub fn audit_metric(entry: AuditEntry) -> telemetry.Metric

Convert one audit entry into a metric point.

pub fn classify(
  sample: BurnRateSample,
  thresholds: Thresholds,
) -> Status

Classify one burn-rate sample against thresholds.

pub fn control_label(control: Control) -> String

Stable control label.

pub fn decision_label(decision: Decision) -> String

Stable decision label.

pub fn default_thresholds() -> Thresholds

Default M30 threshold profile.

pub fn evaluate(
  runtime: Runtime,
  sample: BurnRateSample,
  actor_id: String,
  now_ms: Int,
) -> #(Runtime, Status)

Evaluate one sample and reconcile active controls.

pub fn new(thresholds: Thresholds) -> Runtime

Build one autopilot runtime.

pub fn recommended_controls(
  sample: BurnRateSample,
  status: Status,
) -> List(Control)

Desired controls for one sample/status pair.

pub fn reversible(control: Control) -> Bool

Return True when one control can be rolled back.

pub fn rollback(
  runtime: Runtime,
  control: Control,
  actor_id: String,
  reason: String,
  at_ms: Int,
  status: Status,
) -> Runtime

Roll back one control with an audit trail entry.

pub fn runtime_thresholds(runtime: Runtime) -> Thresholds

Threshold accessor.

pub fn sample(
  service: String,
  slo_name: String,
  short_window_milli: Int,
  long_window_milli: Int,
  hotspot_tenant_id: String,
) -> BurnRateSample

Build one burn-rate sample.

pub fn sample_label(sample: BurnRateSample) -> String

Stable sample label.

pub fn signature(runtime: Runtime) -> String

Stable runtime signature for deterministic fixtures.

pub fn status_label(status: Status) -> String

Stable status label.

pub fn thresholds(
  warn_short_milli: Int,
  warn_long_milli: Int,
  critical_short_milli: Int,
  critical_long_milli: Int,
) -> Thresholds

Build one threshold profile.

pub fn thresholds_label(thresholds: Thresholds) -> String

Stable threshold label.

pub fn valid(runtime: Runtime) -> Bool

Runtime invariants.

Search Document