pub struct Analytics { /* private fields */ }Expand description
Main analytics instance
Thread-safe analytics collector that can be shared across handlers.
Implementations§
Source§impl Analytics
impl Analytics
Sourcepub fn new(config: AnalyticsConfig) -> Self
pub fn new(config: AnalyticsConfig) -> Self
Create a new analytics instance
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 snapshot(&self) -> AnalyticsSnapshot
pub fn snapshot(&self) -> AnalyticsSnapshot
Get current analytics snapshot
Sourcepub fn dashboard_json(&self) -> String
pub fn dashboard_json(&self) -> String
Get JSON dashboard data
Sourcepub fn config(&self) -> &AnalyticsConfig
pub fn config(&self) -> &AnalyticsConfig
Get the configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Analytics
impl !RefUnwindSafe for Analytics
impl Send for Analytics
impl Sync for Analytics
impl Unpin for Analytics
impl !UnwindSafe for Analytics
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