Skip to main content

Trace

Struct Trace 

Source
pub struct Trace {
Show 16 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 predicted_pass: Option<f64>, pub elastic: Option<ElasticDecision>,
}
Expand description

A single routing decision, start to finish.

Fields§

§trace_id: Uuid

Time-ordered unique id (UUIDv7).

§prev_hash: String

Hash of the previous record in this chain (or crate::hashchain::GENESIS_HASH).

§tenant_id: String

Tenant this trace belongs to.

§session_id: String

Session (e.g. an agent run) this request is part of.

§ts: Timestamp

When the decision was made.

§mode: Mode

Serving mode in effect.

§policy: PolicyRef

Which policy produced this decision.

§request: RequestInfo

The 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_: FinalOutcome

The 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.

§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

Source

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.

Source

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

Source§

fn prev_hash(&self) -> &str

The hash of the preceding record (or GENESIS_HASH for the first).
Source§

impl Clone for Trace

Source§

fn clone(&self) -> Trace

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Trace

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Trace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Trace

Source§

fn eq(&self, other: &Trace) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Trace

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Trace

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.