Expand description
Observability as an ECS system: watch the components every other system
already writes and narrate them into the installed TelemetrySink.
The pipeline’s collect systems leave pure-data ActivityRecords on the
agent (an inference landed, a tool batch ran, a compaction finished);
observe_lifecycle runs once per schedule pass near the end of the tick,
turns those plus the agent’s own state into TelemetryEvents, and emits
them. Ordering in the tick chain is load-bearing twice over: the system
must run before sync_tool_stages (which consumes the transient
StageJustEntered marker) and before dispatch_persistence (which
drains StageIoBuffer - this system only reads the buffer, so running
first is what makes each log line observed exactly once).
Structs§
- Stage
Activity - Buffered
ActivityRecords awaiting the observer. Inserted alongsideTelemetryStatethe first time the observer sees an agent, so the collect systems treat it as optional and skip recording until then (an agent’s first inference cannot land before the observer has run once). - Telemetry
- The installed telemetry sink.
crate::world::PipelineWorld::newinstallsleviath_core::telemetry::NoopSink; a host that wants export replaces the resource (the same way it installsPolicyGateorTitleSettings). - Telemetry
State - The observer’s per-agent memory: what it has already narrated.
Enums§
- Activity
Record - One completed piece of stage work, recorded by the collect system that
applied it and drained into events by
observe_lifecycle. Carries only what the collect site knows; run/stage identity is added at drain time.
Functions§
- observe_
lifecycle - Emit lifecycle, activity, and log events for every agent run.