pub struct TracingMiddleware { /* private fields */ }Expand description
Middleware that adds distributed tracing to message processing.
This middleware creates trace spans for each message, capturing:
- Message ID and metadata
- Processing duration
- Success/failure status
- Error details (if any)
When the tracing feature is enabled, it uses the tracing crate
to emit structured events. Otherwise, it logs to stdout.
§Example
use foxtive_worker::TracingMiddleware;
let middleware = TracingMiddleware::new("my-service");Implementations§
Trait Implementations§
Source§impl Debug for TracingMiddleware
impl Debug for TracingMiddleware
Source§impl Middleware for TracingMiddleware
impl Middleware for TracingMiddleware
Source§fn handle<'life0, 'async_trait>(
&'life0 self,
message: ReceivedMessage<Value>,
next: Box<dyn MessageHandler>,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareResult, WorkerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
message: ReceivedMessage<Value>,
next: Box<dyn MessageHandler>,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareResult, WorkerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process a message with access to the next handler in the chain. Read more
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