pub struct Trace {
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,
}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.
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).