Skip to main content

Module observer

Module observer 

Source
Expand description

Watching effects for metrics.

An EffectObserver (RuntimeBuilder::observer) is told about every effect the runtime records and every transition it stores, after the write succeeds. That covers calls, recovery, compensation, approval and operator decisions alike. That is enough for every metric that matters:

  • counts by transition or by status reached (committed, failed, unknown, retries, compensations);
  • attempt duration (Observation::in_previous_status when leaving Executing);
  • time spent unknown (the same, when leaving Unknown);
  • end-to-end duration (Observation::since_created when settling);
  • levels such as “awaiting approval”, as up/down counts. These are deltas since the observer started; for exact current numbers, query Runtime::pending.

The core crate depends on no metrics library; agent-effects-otel implements an observer with OpenTelemetry. An observer that panics is caught and logged: a metrics bug must never break an effect whose transition is already stored.

Structs§

Observation
One stored transition.

Traits§

EffectObserver
Receives effect lifecycle events, for metrics. Both methods default to doing nothing.