pub struct TracingPlugin { /* private fields */ }Expand description
Process-wide TracingPlugin singleton storing TracingConfig and SpanExporter hooks.
Implementations§
Source§impl TracingPlugin
Inherent implementation of TracingPlugin.
impl TracingPlugin
Inherent implementation of TracingPlugin.
Sourcepub fn init(
config: TracingConfig,
exporters: Vec<SharedSpanExporter>,
) -> &'static Self
pub fn init( config: TracingConfig, exporters: Vec<SharedSpanExporter>, ) -> &'static Self
Initializes the global TracingPlugin once with config and optional exporters.
§Arguments
TracingConfig- Header propagation and timing configuration.Vec<SharedSpanExporter>- Span exporters invoked after response handling.
§Returns
&'static Self- Reference to the initialized global plugin.
Sourcepub fn init_default() -> &'static Self
pub fn init_default() -> &'static Self
Initializes the global TracingPlugin once with default configuration and no exporters.
§Returns
&'static Self- Reference to the initialized global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global TracingPlugin, if initialized.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn get_config(&self) -> &TracingConfig
pub fn get_config(&self) -> &TracingConfig
Sourcepub fn current(ctx: &Context) -> Option<TraceContext>
pub fn current(ctx: &Context) -> Option<TraceContext>
Retrieves the active TraceContext stored in ctx.
§Arguments
&Context- Request context.
§Returns
Option<TraceContext>- Active trace context, if tracing ran on this request.
Sourcepub fn start_request(&self, ctx: &mut Context) -> TraceContext
pub fn start_request(&self, ctx: &mut Context) -> TraceContext
Sourcepub fn finish_request(&self, ctx: &mut Context)
pub fn finish_request(&self, ctx: &mut Context)
Finalizes tracing on ctx, setting Server-Timing and exporting a SpanRecord.
§Arguments
&mut Context- Active request/response context.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TracingPlugin
impl !UnwindSafe for TracingPlugin
impl Forget for TracingPlugin
impl Freeze for TracingPlugin
impl Move for TracingPlugin
impl Send for TracingPlugin
impl Sync for TracingPlugin
impl Unpin for TracingPlugin
impl UnsafeUnpin for TracingPlugin
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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