pub struct TraceContext {
pub version: u8,
pub trace_id: String,
pub parent_id: String,
pub flags: u8,
}Expand description
W3C Trace Context (traceparent header) (P2-8).
Format: version-trace_id-parent_id-flags, e.g.
00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01.
trace_id is 32 lowercase hex chars, parent_id 16, flags 2 (bit 0 =
sampled).
Fields§
§version: u8Version byte (currently 0, serialized as "00").
trace_id: String32-char lowercase hex trace id.
parent_id: String16-char lowercase hex parent span id.
flags: u82-char hex flags byte (bit 0 = sampled).
Implementations§
Source§impl TraceContext
impl TraceContext
Sourcepub fn new(trace_id: impl Into<String>, parent_id: impl Into<String>) -> Self
pub fn new(trace_id: impl Into<String>, parent_id: impl Into<String>) -> Self
Create a new (unsampled) trace context with version 00.
Sourcepub fn is_sampled(&self) -> bool
pub fn is_sampled(&self) -> bool
Whether this trace has been marked as sampled.
Sourcepub fn to_traceparent(&self) -> String
pub fn to_traceparent(&self) -> String
Serialize to a traceparent header value.
Trait Implementations§
Source§impl Clone for TraceContext
impl Clone for TraceContext
Source§fn clone(&self) -> TraceContext
fn clone(&self) -> TraceContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TraceContext
impl Debug for TraceContext
Source§impl<'de> Deserialize<'de> for TraceContext
impl<'de> Deserialize<'de> for TraceContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TraceContext
Source§impl PartialEq for TraceContext
impl PartialEq for TraceContext
Source§impl Serialize for TraceContext
impl Serialize for TraceContext
impl StructuralPartialEq for TraceContext
Auto Trait Implementations§
impl Freeze for TraceContext
impl RefUnwindSafe for TraceContext
impl Send for TraceContext
impl Sync for TraceContext
impl Unpin for TraceContext
impl UnsafeUnpin for TraceContext
impl UnwindSafe for TraceContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.