pub struct Trace {Show 17 fields
pub trace_id: Uuid,
pub prev_hash: String,
pub tenant_id: String,
pub session_id: String,
pub ts: Timestamp,
pub mode: Mode,
pub policy: PolicyRef,
pub request: RequestInfo,
pub attempts: Vec<Attempt>,
pub deferred: Vec<DeferredVerdict>,
pub final_: FinalOutcome,
pub probe: Option<ProbeSignal>,
pub rollout: Option<RolloutRecord>,
pub shadow: Option<ShadowSignal>,
pub route_ix: Option<u32>,
pub predicted_pass: Option<f64>,
pub elastic: Option<ElasticDecision>,
}Expand description
A single routing decision, start to finish.
Fields§
§trace_id: UuidTime-ordered unique id (UUIDv7).
prev_hash: StringHash of the previous record in this chain (or crate::hashchain::GENESIS_HASH).
tenant_id: StringTenant this trace belongs to.
session_id: StringSession (e.g. an agent run) this request is part of.
ts: TimestampWhen the decision was made.
mode: ModeServing mode in effect.
policy: PolicyRefWhich policy produced this decision.
request: RequestInfoThe request that was routed.
attempts: Vec<Attempt>Every attempt made, cheapest rung first.
deferred: Vec<DeferredVerdict>Verdicts that arrived after serving (deferred gates, feedback API). Attach over time.
final_: FinalOutcomeThe final served outcome and its economics.
probe: Option<ProbeSignal>Shadow probe signal (ADR 0008 Phase 1). Absent when probe is off (the default) or when
this request was not in the configured sample_rate — byte-identical to pre-probe traces
and hash-chain compatible (the skip_serializing_if keeps absent = absent).
rollout: Option<RolloutRecord>Which rollout arm this request was in (ADR 0009 D1). Absent when the route has no rollout configured.
shadow: Option<ShadowSignal>Counterfactual signal from shadow scoring (ADR 0009 D2). Absent unless shadow is enabled.
route_ix: Option<u32>Index of the route that handled this request, so a downstream outcome arriving later can be attributed to the route that actually produced it (ADR 0009 D3).
Without this the guardrail has to pool every tenant’s outcomes onto one route, which in a multi-route config means a failing route can be masked by healthy siblings — the guard would sit green while the thing it guards degrades. Absent on traces written before this field existed; the guardrail treats absent as route 0, its prior behaviour.
predicted_pass: Option<f64>Shadow prediction of P(gate-pass) for the start rung (ADR 0008 Phase 2), from the
per-query predictor. Absent when the predictor is off (the default) — byte-identical to
pre-predictor traces and hash-chain compatible. Recorded but never acted on in this phase.
elastic: Option<ElasticDecision>Elastic verification decision (ADR 0008 Phase 3) on the served rung: why the expensive gates
were skipped or run, plus the λ / calibration provenance the skip was authorized under.
Absent when elastic is off (the default) — byte-identical to pre-elastic traces and
hash-chain compatible (the skip_serializing_if keeps absent = absent).
Implementations§
Source§impl Trace
impl Trace
Sourcepub fn hash(&self) -> Result<String>
pub fn hash(&self) -> Result<String>
This record’s own hash (SHA-256 over its canonical JSON) — the value the next
record stores as its prev_hash.
§Errors
Returns crate::Error::Json if the trace cannot be serialized.
Sourcepub fn recompute_savings(&mut self) -> f64
pub fn recompute_savings(&mut self) -> f64
Compute savings_usd = baseline - total and store it, keeping the field consistent
with the two it is derived from. Returns the savings.
Trait Implementations§
Source§impl Chained for Trace
impl Chained for Trace
Source§fn prev_hash(&self) -> &str
fn prev_hash(&self) -> &str
GENESIS_HASH for the first).