#[repr(C)]pub struct TraceEvent {
pub ts_ns: u64,
pub entity_id: u32,
pub route_id: u32,
pub span_id: u64,
pub parent_span_id: u64,
pub latency_us: u32,
pub status_code: u16,
pub error_code: u16,
pub event_kind: u16,
pub flags: u16,
}Expand description
A single observable trace point.
All fields are unsigned; the deserializer rejects negative literals. The constructors offered here are intentionally limited — callers should build events via the fixture synthesizer or by parsing canonical JSON, not by direct field assignment, so the bit-stability rules around field widths are honored automatically.
Fields§
§ts_ns: u64Wall-clock timestamp, nanoseconds since the synthetic epoch (event
0). The pipeline derives the window index from this field via
integer division by the contract’s window_size_ms * 1_000_000.
entity_id: u32The entity (service, process, sensor) the event belongs to.
Bounded by n_entities in the contract.
route_id: u32The route within the entity (e.g. an HTTP endpoint or a sensor channel). Not used by the v0 pipeline for windowing but carried into the canonical bytes so the hash chain reflects the full fixture shape.
span_id: u64Tracing span identifier. Carried for fidelity of the catalog hash; not consumed by the residual/sign stages.
parent_span_id: u64Parent span identifier, or 0 for a root.
latency_us: u32Observed latency in microseconds. Clamped to
contract.numeric.latency_clamp_ms * 1000 at the residual boundary
to keep Q16.16 quantization in range.
status_code: u16HTTP-style status code (or a domain-specific equivalent). Carried
through to the canonical bytes; the v0 pipeline checks for the
error class via error_code not status_code.
error_code: u16Domain error code, with 0 meaning no error. Drives the error-rate
derivative of the residual.
event_kind: u16Free-form event-type discriminator (request, response, log, sample). Not consumed in v0 but preserved in the catalog hash.
flags: u16Bit-field for miscellaneous flags (sampled, replayed, simulated). Preserved verbatim for the catalog hash.
Implementations§
Source§impl TraceEvent
impl TraceEvent
Sourcepub const fn new(
ts_ns: u64,
entity_id: u32,
route_id: u32,
span_id: u64,
parent_span_id: u64,
latency_us: u32,
status_code: u16,
error_code: u16,
event_kind: u16,
flags: u16,
) -> Self
pub const fn new( ts_ns: u64, entity_id: u32, route_id: u32, span_id: u64, parent_span_id: u64, latency_us: u32, status_code: u16, error_code: u16, event_kind: u16, flags: u16, ) -> Self
Construct a fully-specified TraceEvent. Used by the fixture
synthesizer and tests. There is no builder pattern on purpose —
the type is small enough that positional construction is more
auditable than a fluent builder.
Sourcepub const fn window_index(&self, window_size_ns: u64) -> u32
pub const fn window_index(&self, window_size_ns: u64) -> u32
The window index this event falls into, given a window size in nanoseconds. Integer division; ties go to the lower window.
Trait Implementations§
Source§impl Clone for TraceEvent
impl Clone for TraceEvent
Source§fn clone(&self) -> TraceEvent
fn clone(&self) -> TraceEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TraceEvent
impl Debug for TraceEvent
Source§impl Default for TraceEvent
impl Default for TraceEvent
Source§fn default() -> TraceEvent
fn default() -> TraceEvent
Source§impl Hash for TraceEvent
impl Hash for TraceEvent
Source§impl PartialEq for TraceEvent
impl PartialEq for TraceEvent
Source§fn eq(&self, other: &TraceEvent) -> bool
fn eq(&self, other: &TraceEvent) -> bool
self and other values to be equal, and is used by ==.