pub struct Guard {
pub otel_guard: Option<OtelGuard>,
pub default_guard: Option<DefaultGuard>,
}Available on crate feature
tracing_subscriber_ext only.Expand description
Combined guard that handles both OtelGuard and optional DefaultGuard
This struct holds the various guards needed to maintain the tracing subscriber.
otel_guard: OpenTelemetry guard for flushing traces/metrics on drop (None when OTEL disabled)default_guard: Subscriber default guard for non-global subscribers (None when using global)
Fields§
§otel_guard: Option<OtelGuard>OpenTelemetry guard for proper cleanup (None when OTEL is disabled)
default_guard: Option<DefaultGuard>Default subscriber guard for non-global mode (None when using global subscriber)
Implementations§
Source§impl Guard
impl Guard
Sourcepub fn global(otel_guard: Option<OtelGuard>) -> Self
pub fn global(otel_guard: Option<OtelGuard>) -> Self
Create a new Guard for global subscriber mode
Sourcepub fn non_global(
otel_guard: Option<OtelGuard>,
default_guard: DefaultGuard,
) -> Self
pub fn non_global( otel_guard: Option<OtelGuard>, default_guard: DefaultGuard, ) -> Self
Create a new Guard for non-global subscriber mode
Sourcepub fn otel_guard(&self) -> Option<&OtelGuard>
pub fn otel_guard(&self) -> Option<&OtelGuard>
Get a reference to the underlying OtelGuard if present
Sourcepub fn is_non_global(&self) -> bool
pub fn is_non_global(&self) -> bool
Check if this guard is managing a non-global (thread-local) subscriber
Auto Trait Implementations§
impl Freeze for Guard
impl !RefUnwindSafe for Guard
impl Send for Guard
impl Sync for Guard
impl Unpin for Guard
impl !UnwindSafe for Guard
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§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>
Wrap the input message
T in a tonic::Request