pub struct PropagationContext {
pub session_id: String,
pub trace_id: String,
pub span_id: String,
pub parent_span_id: Option<String>,
pub agent_id: String,
pub agent_instance_id: String,
pub workspace_id: Option<String>,
pub mission_id: Option<String>,
pub host_id: String,
pub tool_runtime_id: Option<String>,
}Expand description
Context propagated across tool and host boundaries.
Fields§
§session_id: String§trace_id: String§span_id: String§parent_span_id: Option<String>§agent_id: String§agent_instance_id: String§workspace_id: Option<String>§mission_id: Option<String>§host_id: String§tool_runtime_id: Option<String>Implementations§
Source§impl PropagationContext
impl PropagationContext
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Read context from environment variables.
Returns None if required fields (TREESHIP_SESSION_ID, TREESHIP_TRACE_ID)
are not present.
Sourcepub fn inject_env(&self, cmd: &mut Command)
pub fn inject_env(&self, cmd: &mut Command)
Inject context as environment variables on a Command builder.
Sourcepub fn to_headers(&self) -> Vec<(String, String)>
pub fn to_headers(&self) -> Vec<(String, String)>
Produce HTTP header pairs for outbound requests.
Sourcepub fn from_headers(headers: &[(String, String)]) -> Option<Self>
pub fn from_headers(headers: &[(String, String)]) -> Option<Self>
Parse context from HTTP header pairs.
Sourcepub fn child_span(&self) -> Self
pub fn child_span(&self) -> Self
Generate a child span context: new span_id, current span_id becomes parent.
Sourcepub fn to_traceparent(&self) -> String
pub fn to_traceparent(&self) -> String
Generate a W3C traceparent header value.
Trait Implementations§
Source§impl Clone for PropagationContext
impl Clone for PropagationContext
Source§fn clone(&self) -> PropagationContext
fn clone(&self) -> PropagationContext
Returns a duplicate of the value. Read more
1.0.0 · 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 PropagationContext
impl Debug for PropagationContext
Source§impl<'de> Deserialize<'de> for PropagationContext
impl<'de> Deserialize<'de> for PropagationContext
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
Auto Trait Implementations§
impl Freeze for PropagationContext
impl RefUnwindSafe for PropagationContext
impl Send for PropagationContext
impl Sync for PropagationContext
impl Unpin for PropagationContext
impl UnsafeUnpin for PropagationContext
impl UnwindSafe for PropagationContext
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