pub struct HttpMonitoringMiddleware { /* private fields */ }Expand description
HTTP middleware for request monitoring
Implementations§
Source§impl HttpMonitoringMiddleware
impl HttpMonitoringMiddleware
Sourcepub fn new(metrics_collector: Arc<MetricsCollector>) -> HttpMonitoringMiddleware
pub fn new(metrics_collector: Arc<MetricsCollector>) -> HttpMonitoringMiddleware
Create a new HTTP monitoring middleware
Sourcepub fn with_config(
metrics_collector: Arc<MetricsCollector>,
enabled: bool,
) -> HttpMonitoringMiddleware
pub fn with_config( metrics_collector: Arc<MetricsCollector>, enabled: bool, ) -> HttpMonitoringMiddleware
Create a new HTTP monitoring middleware with custom settings
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if the middleware is enabled
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Set whether the middleware is enabled
Sourcepub async fn process_request(&self, method: &str, path: &str) -> RequestContext
pub async fn process_request(&self, method: &str, path: &str) -> RequestContext
Process an incoming HTTP request
Sourcepub async fn process_response(
&self,
context: &RequestContext,
status_code: u16,
success: bool,
)
pub async fn process_response( &self, context: &RequestContext, status_code: u16, success: bool, )
Process a completed HTTP request
Auto Trait Implementations§
impl Freeze for HttpMonitoringMiddleware
impl !RefUnwindSafe for HttpMonitoringMiddleware
impl Send for HttpMonitoringMiddleware
impl Sync for HttpMonitoringMiddleware
impl Unpin for HttpMonitoringMiddleware
impl !UnwindSafe for HttpMonitoringMiddleware
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