pub struct TraceContext {
pub version: u8,
pub trace_id: [u8; 16],
pub parent_id: [u8; 8],
pub trace_flags: u8,
}Expand description
W3C Trace Context (traceparent header)
Represents distributed trace context passed across service boundaries. Enables Renacer to create syscall spans as children of application spans.
Fields§
§version: u8§trace_id: [u8; 16]§parent_id: [u8; 8]§trace_flags: u8Implementations§
Source§impl TraceContext
impl TraceContext
Sourcepub fn parse(traceparent: &str) -> Result<Self, TraceContextError>
pub fn parse(traceparent: &str) -> Result<Self, TraceContextError>
Parse W3C traceparent string
Format: “00-{trace_id}-{parent_id}-{flags}” Example: “00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01”
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Extract trace context from environment variables
Checks TRACEPARENT and OTEL_TRACEPARENT (in that order)
Sourcepub fn set_env(&self)
pub fn set_env(&self)
Set trace context as environment variable (Sprint 42: Batuta Integration)
Sets TRACEPARENT for child processes to inherit trace context.
This enables distributed tracing across exec() boundaries.
Sourcepub fn logical_clock_from_env() -> Option<u64>
pub fn logical_clock_from_env() -> Option<u64>
Extract logical clock from environment variable (Sprint 42: Batuta Integration)
Checks RENACER_LOGICAL_CLOCK environment variable.
Returns None if not set or invalid format.
Sourcepub fn set_logical_clock_env(timestamp: u64)
pub fn set_logical_clock_env(timestamp: u64)
Set logical clock as environment variable (Sprint 42: Batuta Integration)
Sets RENACER_LOGICAL_CLOCK for child processes to inherit.
This propagates Lamport logical clocks across exec() boundaries.
Sourcepub fn is_sampled(&self) -> bool
pub fn is_sampled(&self) -> bool
Check if trace is sampled (trace_flags & 0x01)
Trait Implementations§
Source§impl Clone for TraceContext
impl Clone for TraceContext
Source§fn clone(&self) -> TraceContext
fn clone(&self) -> TraceContext
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 TraceContext
impl Debug for TraceContext
Source§impl Display for TraceContext
impl Display for TraceContext
Source§impl PartialEq for TraceContext
impl PartialEq for TraceContext
Source§fn eq(&self, other: &TraceContext) -> bool
fn eq(&self, other: &TraceContext) -> bool
self and other values to be equal, and is used by ==.