Cyclium.ServiceLevels (Cyclium v0.1.15)

Copy Markdown View Source

ETS-backed performance objectives tracking per expectation.

Tracks episode duration and success rate, and detects breaches against declared performance objectives.

Configuration

Set service_levels on an expectation:

expect :check_health,
  service_levels: %{max_duration_ms: 30_000, success_rate: 0.95, window_episodes: 50}

ETS layout

Key: {actor_id, expectation_id} Value: %{config: map, samples: [map], ...}

Summary

Functions

Check if performance objectives are being met.

Idempotent ETS table creation.

Get current metrics for an expectation.

Register performance objectives config for an expectation.

Functions

check(actor_id, expectation_id)

Check if performance objectives are being met.

Returns :ok or {:breach, details}.

ensure_table()

Idempotent ETS table creation.

metrics(actor_id, expectation_id)

Get current metrics for an expectation.

record(actor_id, expectation_id, measurements)

Record an episode outcome.

measurements should include:

  • :duration_ms — episode wall-clock time in milliseconds
  • :success — boolean

register(actor_id, expectation_id, config)

Register performance objectives config for an expectation.