pub struct MetricsCollector { /* private fields */ }Expand description
Thread-safe metrics collector
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
pub fn new() -> Self
pub fn with_limits( max_latency_samples: usize, max_recent_errors: usize, max_endpoints: usize, max_rate_limit_clients: usize, ) -> Self
Sourcepub fn from_config(config: &AnalyticsConfig) -> Self
pub fn from_config(config: &AnalyticsConfig) -> Self
Build a collector from a full crate::AnalyticsConfig, honoring both
the capacity knobs and the behavioral toggles/windows.
Sourcepub fn record_request(&self, record: RequestRecord)
pub fn record_request(&self, record: RequestRecord)
Record a request
Sourcepub fn record_rate_limit(&self, event: RateLimitEvent)
pub fn record_rate_limit(&self, event: RateLimitEvent)
Record a rate limit event
Sourcepub fn record_error(&self, error: ErrorRecord)
pub fn record_error(&self, error: ErrorRecord)
Record an error
Sourcepub fn request_metrics(&self) -> RequestMetrics
pub fn request_metrics(&self) -> RequestMetrics
Get request metrics
Sourcepub fn latency_metrics(&self) -> LatencyMetrics
pub fn latency_metrics(&self) -> LatencyMetrics
Get latency metrics
Sourcepub fn error_metrics(&self) -> ErrorMetrics
pub fn error_metrics(&self) -> ErrorMetrics
Get error metrics
Sourcepub fn rate_limit_metrics(&self) -> RateLimitMetrics
pub fn rate_limit_metrics(&self) -> RateLimitMetrics
Get rate limit metrics
Sourcepub fn endpoint_metrics(&self) -> Vec<EndpointMetrics>
pub fn endpoint_metrics(&self) -> Vec<EndpointMetrics>
Get per-endpoint metrics
Sourcepub fn throughput_metrics(&self) -> ThroughputMetrics
pub fn throughput_metrics(&self) -> ThroughputMetrics
Get throughput metrics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MetricsCollector
impl !RefUnwindSafe for MetricsCollector
impl Send for MetricsCollector
impl Sync for MetricsCollector
impl Unpin for MetricsCollector
impl UnsafeUnpin for MetricsCollector
impl UnwindSafe for MetricsCollector
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<R, D> DepsPresent<D> for R
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging