Skip to main content

TraceState

Struct TraceState 

Source
pub struct TraceState {
    pub route: String,
    pub trace_id: String,
    pub trace_path: String,
    pub span_id: String,
    pub parent_span_id: Option<String>,
    pub cid: Option<String>,
    pub start_time: String,
    pub annotations: HashMap<String, Value>,
    pub custom_log_keys: HashMap<String, Value>,
    pub zero_traced: bool,
}
Expand description

Per-execution trace state (Java TraceInfo + LogContext, combined — one task-local anchor holds both the trace identity and the log context).

Fields§

§route: String§trace_id: String§trace_path: String§span_id: String

This execution’s own span (16-hex, minted at creation — Java parity).

§parent_span_id: Option<String>

The caller’s span, taken from the incoming envelope’s span_id.

§cid: Option<String>

The business correlation id captured from the incoming event — a separate concern from the trace id.

§start_time: String

ISO-8601 UTC start time (Java TraceInfo.startTime).

§annotations: HashMap<String, Value>

Business annotations for the distributed-trace dataset (PostOffice::annotate_trace) — flows to the telemetry sink.

§custom_log_keys: HashMap<String, Value>

Developer-supplied log-context key-values (PostOffice::update_context) — flows to the application log only.

§zero_traced: bool

True on a zero-traced route: the trace CONTEXT still flows (replies and nested calls keep the trace id/path — Java propagates them from the incoming event unconditionally), but this hop emits no telemetry and mints no span into the chain (Java never calls startTracing, so touch() finds no TraceInfo and stamps no span id).

Implementations§

Source§

impl TraceState

Source

pub fn new( route: &str, trace_id: &str, trace_path: &str, parent_span_id: Option<&str>, cid: Option<&str>, ) -> Self

Source

pub fn token(&self, token: &str, log_time: SystemTime) -> Option<Value>

Resolve a reserved log-context token to its live value (Java LogContext.token). None means the key is omitted from the output (never rendered as null).

Trait Implementations§

Source§

impl Clone for TraceState

Source§

fn clone(&self) -> TraceState

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 TraceState

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V