pub struct DMSCContextCarrier {
pub trace_context: Option<DMSCTraceContext>,
pub baggage: DMSCBaggage,
}Expand description
Context carrier for distributed tracing.
This struct carries both trace context and baggage, providing a convenient way to extract and inject distributed tracing information from/to HTTP headers.
Fields§
§trace_context: Option<DMSCTraceContext>Trace context for the request
baggage: DMSCBaggageBaggage for additional context
Implementations§
Source§impl DMSCContextCarrier
impl DMSCContextCarrier
Sourcepub fn with_trace_context(self, trace_context: DMSCTraceContext) -> Self
pub fn with_trace_context(self, trace_context: DMSCTraceContext) -> Self
Sourcepub fn with_baggage(self, baggage: DMSCBaggage) -> Self
pub fn with_baggage(self, baggage: DMSCBaggage) -> Self
Sourcepub fn from_tracing_context(tracing_context: &DMSCTracingContext) -> Self
pub fn from_tracing_context(tracing_context: &DMSCTracingContext) -> Self
Creates a context carrier from tracing context.
This method converts a thread-local DMSCTracingContext into a DMSCContextCarrier that can be propagated across service boundaries.
§Parameters
tracing_context: The tracing context to convert
§Returns
A new DMSCContextCarrier instance with trace context and baggage from the tracing context
Sourcepub fn into_tracing_context(self) -> DMSCTracingContext
pub fn into_tracing_context(self) -> DMSCTracingContext
Creates a tracing context from this carrier.
This method converts a DMSCContextCarrier into a thread-local DMSCTracingContext that can be used for tracing within the service.
§Returns
A new DMSCTracingContext instance with trace context and baggage from the carrier
Sourcepub fn from_headers(headers: &HashMap<String, String>) -> Self
pub fn from_headers(headers: &HashMap<String, String>) -> Self
Sourcepub fn inject_into_headers(&self, headers: &mut HashMap<String, String>)
pub fn inject_into_headers(&self, headers: &mut HashMap<String, String>)
Injects the context carrier into HTTP headers.
§Parameters
headers: A mutable HashMap of HTTP headers to inject into
Sourcepub fn from_headers_and_set_current(headers: &HashMap<String, String>) -> Self
pub fn from_headers_and_set_current(headers: &HashMap<String, String>) -> Self
Extracts a context carrier from HTTP headers and sets it as current tracing context.
This convenience method extracts trace information from HTTP headers, creates a tracing context, and sets it as the current thread-local context.
§Parameters
headers: A HashMap of HTTP headers
§Returns
A new DMSCContextCarrier instance with extracted trace context and baggage
Sourcepub fn inject_current_into_headers(headers: &mut HashMap<String, String>)
pub fn inject_current_into_headers(headers: &mut HashMap<String, String>)
Injects the current tracing context into HTTP headers.
This convenience method gets the current thread-local tracing context, converts it to a context carrier, and injects it into HTTP headers.
§Parameters
headers: A mutable HashMap of HTTP headers to inject into
Trait Implementations§
Source§impl Clone for DMSCContextCarrier
impl Clone for DMSCContextCarrier
Source§fn clone(&self) -> DMSCContextCarrier
fn clone(&self) -> DMSCContextCarrier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DMSCContextCarrier
impl Debug for DMSCContextCarrier
Source§impl Default for DMSCContextCarrier
impl Default for DMSCContextCarrier
Source§impl<'py> IntoPyObject<'py> for DMSCContextCarrier
impl<'py> IntoPyObject<'py> for DMSCContextCarrier
Source§type Target = DMSCContextCarrier
type Target = DMSCContextCarrier
Source§type Output = Bound<'py, <DMSCContextCarrier as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DMSCContextCarrier as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for DMSCContextCarrier
impl PyClass for DMSCContextCarrier
Source§impl PyClassImpl for DMSCContextCarrier
impl PyClassImpl for DMSCContextCarrier
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"Context carrier for distributed tracing.\n\nThis struct carries both trace context and baggage, providing a convenient way to\nextract and inject distributed tracing information from/to HTTP headers.\x00"
const RAW_DOC: &'static CStr = c"Context carrier for distributed tracing.\n\nThis struct carries both trace context and baggage, providing a convenient way to\nextract and inject distributed tracing information from/to HTTP headers.\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<DMSCContextCarrier>
type ThreadChecker = SendablePyClass<DMSCContextCarrier>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature for DMSCContextCarrier
impl PyClassNewTextSignature for DMSCContextCarrier
const TEXT_SIGNATURE: &'static str = "()"
Source§impl PyMethods<DMSCContextCarrier> for PyClassImplCollector<DMSCContextCarrier>
impl PyMethods<DMSCContextCarrier> for PyClassImplCollector<DMSCContextCarrier>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for DMSCContextCarrier
impl PyTypeInfo for DMSCContextCarrier
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for DMSCContextCarrier
impl ExtractPyClassWithClone for DMSCContextCarrier
Auto Trait Implementations§
impl Freeze for DMSCContextCarrier
impl RefUnwindSafe for DMSCContextCarrier
impl Send for DMSCContextCarrier
impl Sync for DMSCContextCarrier
impl Unpin for DMSCContextCarrier
impl UnwindSafe for DMSCContextCarrier
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more