Skip to main content

Module trace

Module trace 

Source
Expand description

Trace assembly: open, attach event, close. Emits dense, monotonic ordinals.

A TraceAssembler is the in-memory bookkeeping for one open trace. It tracks the trace id, the open status, and the next ordinal to assign. Attach returns the ordinal an event should be persisted with (in trace_events.ordinal, BUILD_SPEC §10).

§Ordinal invariants

  • The first attached event gets ordinal 0.
  • Ordinals are dense (no gaps) and strictly monotonic within a trace.
  • Closing a trace freezes its ordinals; further attaches return Err(TraceError::Closed).

These match the UNIQUE (trace_id, ordinal) constraint in trace_events.

§What this module does NOT do

  • Persist anything. The caller composes a TraceAssembler with a JsonlLog (and later, a cortex-store repository) to actually write rows.
  • Compute hashes. Hash chaining is crate::hash’s job; the assembler is purely about ordinal bookkeeping and trace lifecycle.

Structs§

TraceAssembler
In-memory assembler for one trace.

Enums§

TraceError
Errors raised by TraceAssembler.