pub struct MetricsPlugin { /* private fields */ }
Expand description
Plugin for collecting request/response metrics
Implementations§
Source§impl MetricsPlugin
impl MetricsPlugin
Sourcepub fn new(_config: PluginConfig) -> Self
pub fn new(_config: PluginConfig) -> Self
Create a new metrics plugin
Sourcepub fn get_metrics(&self) -> MetricsData
pub fn get_metrics(&self) -> MetricsData
Get current metrics data
Sourcepub fn reset_metrics(&self)
pub fn reset_metrics(&self)
Reset all metrics
Trait Implementations§
Source§impl ClientPlugin for MetricsPlugin
impl ClientPlugin for MetricsPlugin
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
Optional plugin description
Source§fn initialize<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn initialize<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PluginContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize the plugin Read more
Source§fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut RequestContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut RequestContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Hook called before sending a request to the server Read more
Source§fn after_response<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut ResponseContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_response<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 mut ResponseContext,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Hook called after receiving a response from the server Read more
Source§fn handle_custom<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = PluginResult<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_custom<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = PluginResult<Option<Value>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle custom methods not part of the standard MCP protocol Read more
Source§fn dependencies(&self) -> Vec<&str>
fn dependencies(&self) -> Vec<&str>
Plugin dependencies (other plugins that must be registered first)
Auto Trait Implementations§
impl Freeze for MetricsPlugin
impl RefUnwindSafe for MetricsPlugin
impl Send for MetricsPlugin
impl Sync for MetricsPlugin
impl Unpin for MetricsPlugin
impl UnwindSafe for MetricsPlugin
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