Expand description
katra-trace — the Katra trace format.
A trace is a versioned, deterministic, append-only stream of records:
[magic: 8 bytes] [format_version: u32] [header_len: u32] [header: bincode]
[record_len: u32] [record: bincode(TraceRecord)] ... (repeat)Records are Event, EpochMarker, Counter, or SessionSummary.
§Determinism
seqis monotonic; events are written inseqorder.- Timestamps are ns since profiler start (plus a wall-clock anchor in the header and in epoch markers).
- Replay can therefore re-emit a trace at exact relative timing.
§Versioning discipline
- Enum layouts are serialized by variant index: append new variants at
the end of any enum in
katra-core. - Any layout-affecting change bumps
header::SCHEMA_HASH(computed fromheader::SCHEMA_STRINGat compile time). - Backward-incompatible changes bump
header::FORMAT_VERSION.
Re-exports§
pub use header::FORMAT_VERSION;pub use header::SCHEMA_HASH;pub use header::SCHEMA_STRING;pub use header::TRACE_MAGIC;pub use header::TraceHeader;pub use reader::TraceReader;pub use reader::TraceReaderError;pub use record::TraceRecord;pub use record::TraceSummary;pub use verify::VerifyIssue;pub use verify::VerifyReport;pub use writer::TraceWriter;pub use writer::default_header;
Modules§
- header
- Trace header: magic, format version, schema hash, and capture metadata.
- reader
- Trace reader: iterates records from a trace file with validation.
- record
- Trace records.
- verify
- Trace verification: checks the invariants a well-formed trace must obey.
- writer
- Trace writer: appends length-prefixed bincode records to a file.