Struct Propagation Context

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

pub struct PropagationContext {
    pub version: u16,
    pub root_uuid: Option<Uuid>,
    pub parent_uuid: Uuid,
    pub traceparent: Option<String>,
    pub tracestate: Option<String>,
}

Versioned, transport-neutral causal context for crossing a Relay boundary.

Applications are responsible for serializing, transporting, authenticating, and trusting this value. It intentionally contains only Relay identifiers; OpenTelemetry traceparent and tracestate are optional transport fields. A valid pair continues an upstream OpenTelemetry trace while Relay UUIDs continue to own Relay event parentage.

Fields

version: u16

Wire-format version. Version 1 is the only currently supported value.

root_uuid: Option<Uuid>

Stable session root when the sending application knows one. When this root and a valid traceparent are both absent, the first local OpenTelemetry span after import starts a new trace.

parent_uuid: Uuid

Immediate Relay event or scope that caused the boundary crossing.

traceparent: Option<String>

Optional W3C traceparent header for the remote OpenTelemetry parent.

tracestate: Option<String>

Optional W3C tracestate header associated with traceparent.

Implementations

impl PropagationContext

impl PropagationContext

VERSION

pub const VERSION: u16 = 1

The current wire-format version.

to_json

pub fn to_json(&self) -> Result<String>

Serialize this validated context for application-managed transport.

to_traceparent

pub fn to_traceparent(&self) -> Result<String>

Convert this context to a W3C traceparent header value.

A valid imported W3C context is forwarded even without a Relay root; otherwise a Relay root is required to derive a trace ID.

from_json

pub fn from_json(value: &str) -> Result<Self>

Deserialize and validate a context received from application-managed transport.

validate

pub fn validate(&self) -> Result<()>

Validate a context received from an untrusted transport.

normalized

pub fn normalized(self) -> Self

Discard invalid W3C headers while retaining valid Relay identifiers.

Trait Implementations

impl Clone for PropagationContext

impl Clone for PropagationContext

clone

fn clone(&self) -> PropagationContext

clone_from

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

impl Debug for PropagationContext

impl Debug for PropagationContext

fmt

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

impl<'de> Deserialize<'de> for PropagationContext

impl<'de> Deserialize<'de> for PropagationContext

deserialize

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

impl PartialEq for PropagationContext

impl PartialEq for PropagationContext

eq

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

ne

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

impl Serialize for PropagationContext

impl Serialize for PropagationContext

serialize

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

impl Eq for PropagationContext

impl Eq for PropagationContext

impl StructuralPartialEq for PropagationContext

impl StructuralPartialEq for PropagationContext