pub struct TracingMiddleware {
pub sampling_strategy: SamplingStrategy,
pub sampling_rate: f64,
/* private fields */
}Expand description
Middleware that creates tracing spans around module execution.
WARNING: The internal span stack is not safe for concurrent use on the same middleware instance. Use separate instances per concurrent pipeline.
Fields§
§sampling_strategy: SamplingStrategy§sampling_rate: f64Implementations§
Source§impl TracingMiddleware
impl TracingMiddleware
Sourcepub fn new(exporter: Box<dyn SpanExporter>) -> TracingMiddleware
pub fn new(exporter: Box<dyn SpanExporter>) -> TracingMiddleware
Create a new tracing middleware with the given exporter (Always sampling).
Sourcepub fn with_sampling(
exporter: Box<dyn SpanExporter>,
strategy: SamplingStrategy,
rate: f64,
) -> TracingMiddleware
pub fn with_sampling( exporter: Box<dyn SpanExporter>, strategy: SamplingStrategy, rate: f64, ) -> TracingMiddleware
Create with explicit sampling configuration.
Trait Implementations§
Source§impl Debug for TracingMiddleware
impl Debug for TracingMiddleware
Source§impl Middleware for TracingMiddleware
impl Middleware for TracingMiddleware
Source§fn before<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
module_id: &'life1 str,
_inputs: Value,
ctx: &'life2 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TracingMiddleware: 'async_trait,
fn before<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
module_id: &'life1 str,
_inputs: Value,
ctx: &'life2 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TracingMiddleware: 'async_trait,
Called before module execution. Can modify input.
Return
Ok(None) to pass through unchanged, Ok(Some(v)) to modify.Source§fn after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_module_id: &'life1 str,
_inputs: Value,
_output: Value,
ctx: &'life2 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TracingMiddleware: 'async_trait,
fn after<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_module_id: &'life1 str,
_inputs: Value,
_output: Value,
ctx: &'life2 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
TracingMiddleware: 'async_trait,
Called after successful module execution. Can modify output.
inputs is the original (post-before) input for correlation.
Return Ok(None) to pass through unchanged, Ok(Some(v)) to modify.Source§fn on_error<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_module_id: &'life1 str,
_inputs: Value,
error: &'life2 ModuleError,
ctx: &'life3 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
TracingMiddleware: 'async_trait,
fn on_error<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_module_id: &'life1 str,
_inputs: Value,
error: &'life2 ModuleError,
ctx: &'life3 Context<Value>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, ModuleError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
TracingMiddleware: 'async_trait,
Called when module execution fails.
inputs is the original (post-before) input for correlation.
Return Ok(Some(v)) to signal recovery (retry with those inputs),
or Ok(None) to let the error propagate.Auto Trait Implementations§
impl !Freeze for TracingMiddleware
impl !RefUnwindSafe for TracingMiddleware
impl Send for TracingMiddleware
impl Sync for TracingMiddleware
impl Unpin for TracingMiddleware
impl UnsafeUnpin for TracingMiddleware
impl !UnwindSafe for TracingMiddleware
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