pub struct EventCollector { /* private fields */ }Expand description
Event collector for recording connection events.
This struct is cheap to clone and can be shared across threads. Events are sent through a bounded channel to a background writer.
Implementations§
Source§impl EventCollector
impl EventCollector
Sourcepub fn record(&self, event: ConnectionEvent) -> bool
pub fn record(&self, event: ConnectionEvent) -> bool
Record a connection event (non-blocking).
Returns true if the event was queued, false if the buffer is full.
Sourcepub fn connection(
&self,
conn_id: u64,
peer: SocketAddr,
) -> ConnectionEventBuilder
pub fn connection( &self, conn_id: u64, peer: SocketAddr, ) -> ConnectionEventBuilder
Create a connection event builder for the given connection.
The builder will automatically send the event when dropped.
Sourcepub fn should_sample(&self, user_id: Option<&str>) -> bool
pub fn should_sample(&self, user_id: Option<&str>) -> bool
Check if an event should be recorded based on sampling configuration.
Returns true if the event should be recorded.
Sourcepub fn privacy(&self) -> &AnalyticsPrivacyConfig
pub fn privacy(&self) -> &AnalyticsPrivacyConfig
Get the privacy configuration.
Trait Implementations§
Source§impl Clone for EventCollector
impl Clone for EventCollector
Source§fn clone(&self) -> EventCollector
fn clone(&self) -> EventCollector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EventCollector
impl RefUnwindSafe for EventCollector
impl Send for EventCollector
impl Sync for EventCollector
impl Unpin for EventCollector
impl UnsafeUnpin for EventCollector
impl UnwindSafe for EventCollector
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