Skip to main content

Metrics

Struct Metrics 

Source
pub struct Metrics {
Show 17 fields pub connections_total: AtomicU64, pub connections_active: AtomicU64, pub handshakes_total: AtomicU64, pub handshakes_success: AtomicU64, pub handshakes_failed: AtomicU64, pub messages_sent: AtomicU64, pub messages_received: AtomicU64, pub bytes_sent: AtomicU64, pub bytes_received: AtomicU64, pub compression_total: AtomicU64, pub compression_success: AtomicU64, pub encryption_total: AtomicU64, pub encryption_success: AtomicU64, pub replay_cache_hits: AtomicU64, pub replay_cache_misses: AtomicU64, pub connection_errors: AtomicU64, pub protocol_errors: AtomicU64, /* private fields */
}
Expand description

Global metrics collector for protocol operations

Fields§

§connections_total: AtomicU64

Total connections established

§connections_active: AtomicU64

Currently active connections

§handshakes_total: AtomicU64

Total handshake attempts

§handshakes_success: AtomicU64

Successful handshakes

§handshakes_failed: AtomicU64

Failed handshakes

§messages_sent: AtomicU64

Total messages sent

§messages_received: AtomicU64

Total messages received

§bytes_sent: AtomicU64

Total bytes sent

§bytes_received: AtomicU64

Total bytes received

§compression_total: AtomicU64

Total compression operations

§compression_success: AtomicU64

Successful compression operations

§encryption_total: AtomicU64

Total encryption operations

§encryption_success: AtomicU64

Successful encryption operations

§replay_cache_hits: AtomicU64

Total replay cache hits

§replay_cache_misses: AtomicU64

Total replay cache misses

§connection_errors: AtomicU64

Connection errors

§protocol_errors: AtomicU64

Protocol errors

Implementations§

Source§

impl Metrics

Source

pub fn new() -> Self

Create a new metrics collector

Source

pub fn connection_established(&self)

Record a new connection

Source

pub fn connection_closed(&self)

Record a connection closed

Source

pub fn handshake_attempt(&self)

Record a handshake attempt

Source

pub fn handshake_success(&self)

Record a successful handshake

Source

pub fn handshake_failed(&self)

Record a failed handshake

Source

pub fn message_sent(&self, byte_count: u64)

Record a message sent

Source

pub fn message_received(&self, byte_count: u64)

Record a message received

Source

pub fn compression_attempt(&self)

Record a compression attempt

Source

pub fn compression_success(&self)

Record a successful compression

Source

pub fn encryption_attempt(&self)

Record an encryption attempt

Source

pub fn encryption_success(&self)

Record a successful encryption

Source

pub fn replay_cache_hit(&self)

Record a replay cache hit

Source

pub fn replay_cache_miss(&self)

Record a replay cache miss

Source

pub fn connection_error(&self)

Record a connection error

Source

pub fn protocol_error(&self)

Record a protocol error

Source

pub fn snapshot(&self) -> MetricsSnapshot

Get current metrics snapshot

Source

pub fn log_metrics(&self)

Log current metrics

Trait Implementations§

Source§

impl Debug for Metrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Metrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more