pub struct TransportMetrics {
pub bytes_sent: u64,
pub bytes_received: u64,
pub messages_sent: u64,
pub messages_received: u64,
pub connections: u64,
pub failed_connections: u64,
pub average_latency_ms: f64,
pub active_connections: u64,
pub compression_ratio: Option<f64>,
pub metadata: HashMap<String, Value>,
}Expand description
A serializable snapshot of a transport’s performance metrics.
This struct provides a consistent view of metrics for external monitoring.
For internal, high-performance updates, AtomicMetrics is preferred.
§Custom Transport Metrics
Transport implementations can store custom metrics in the metadata field.
let mut metrics = TransportMetrics::default();
metrics.metadata.insert("active_correlations".to_string(), json!(42));Fields§
§bytes_sent: u64Total number of bytes sent.
bytes_received: u64Total number of bytes received.
messages_sent: u64Total number of messages sent.
messages_received: u64Total number of messages received.
connections: u64Total number of connection attempts.
failed_connections: u64Total number of failed connection attempts.
average_latency_ms: f64The average latency of operations, in milliseconds.
active_connections: u64The current number of active connections.
compression_ratio: Option<f64>The compression ratio (uncompressed size / compressed size), if applicable.
metadata: HashMap<String, Value>A map for custom, transport-specific metrics.
Trait Implementations§
Source§impl Clone for TransportMetrics
impl Clone for TransportMetrics
Source§fn clone(&self) -> TransportMetrics
fn clone(&self) -> TransportMetrics
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 moreSource§impl Debug for TransportMetrics
impl Debug for TransportMetrics
Source§impl Default for TransportMetrics
impl Default for TransportMetrics
Source§fn default() -> TransportMetrics
fn default() -> TransportMetrics
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TransportMetrics
impl<'de> Deserialize<'de> for TransportMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TransportMetrics
impl RefUnwindSafe for TransportMetrics
impl Send for TransportMetrics
impl Sync for TransportMetrics
impl Unpin for TransportMetrics
impl UnwindSafe for TransportMetrics
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