Skip to main content

Module layer

Module layer 

Source
Expand description

Custom tracing layer that captures plain trace events for invariants.

SimulationLayer subscribes to ordinary tracing events — the same emissions production observability consumes. An event is captured iff:

  1. its level is INFO or more severe, and
  2. it is emitted inside a span carrying an ip field (the orchestrator wraps every process and workload task in such a span), and
  3. it has a non-empty message, which becomes the event’s name.

Runner-injected fault events bypass tracing entirely: the orchestrator drains them from the simulation engine and records them via SimulationLayerHandle::record_sim_fault with source = "sim".

Simulation time is stamped from the layer’s internal clock, advanced by the orchestrator via SimulationLayerHandle::set_sim_time_ms after each step. Invariants are run by the orchestrator through SimulationLayerHandle::run_invariants — never from inside tracing dispatch.

Storage is held behind a parking_lot::Mutex to satisfy the Send + Sync bound on tracing::Layer. moonpool simulations run single-threaded so the mutex is uncontended.

Structs§

InstallGuard
Drop-guard returned by SimulationLayer::install. Restores the previous subscriber when dropped.
SimulationLayer
A tracing::Layer that captures plain trace events emitted inside process/workload spans.
SimulationLayerHandle
Cheap-to-clone handle to a SimulationLayer’s captured state.