#[non_exhaustive]pub struct NetworkMetrics {
pub relay_connections: u64,
pub relay_connections_failed: u64,
pub relay_connections_ratelimited: u64,
}Expand description
What the transport underneath a pipe has been doing, as plain numbers.
A snapshot taken at the moment it was asked for, and owned outright:
every field is a u64 this crate copied out of iroh’s counters, rather
than a borrow of them. That is the difference between a status page and
a leak — Endpoint::metrics hands back a reference to iroh’s own
metrics types, and returning one would put both iroh and its metrics
crate in the signature of a method whose entire output is three
integers.
Monotonic totals for the life of one endpoint, not rates and not gauges. They only ever climb, and they start at zero when the pipe is created; what a caller wants is nearly always the difference between two readings, or the ratio between two fields of one. A pipe that is torn down and re-established starts a fresh endpoint and therefore fresh counts.
#[non_exhaustive], so fields can be added without breaking a caller,
and Copy so holding one in a UI’s state costs nothing.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.relay_connections: u64Relay connections this endpoint established, counted once each time one is made — so a relay that drops and is reconnected to counts twice.
The denominator for the two fields below. On its own it says only whether this endpoint has ever reached a relay at all, which is worth knowing on a machine that reports no relay in its ticket.
relay_connections_failed: u64Failed attempts to reach a relay, counted per attempt.
An unreachable relay increments this on every retry, so the number grows without bound while nothing works and stops the moment something does. It is a rate in disguise: two readings a few seconds apart say whether this endpoint is currently failing to reach a relay, which no single reading can.
relay_connections_ratelimited: u64Relay connections on which the relay reported that it was rate limiting this endpoint.
The one a status page has no other way to learn. A throttled
pipe is not down: requests still cross it, slowly, and every other
signal available says the pipe is fine — the status reads relayed,
the peer is present, and nothing fails. This is what separates “the
relay is far away” from “the relay is holding this endpoint back”,
and the answer changes what an operator should do about it.
Counted at most once per connection, so it is a count of affected
connections rather than of complaints; relate it to
relay_connections for the proportion.
Trait Implementations§
Source§impl Clone for NetworkMetrics
impl Clone for NetworkMetrics
Source§fn clone(&self) -> NetworkMetrics
fn clone(&self) -> NetworkMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NetworkMetrics
Source§impl Debug for NetworkMetrics
impl Debug for NetworkMetrics
Source§impl Default for NetworkMetrics
impl Default for NetworkMetrics
Source§fn default() -> NetworkMetrics
fn default() -> NetworkMetrics
Source§impl<'de> Deserialize<'de> for NetworkMetrics
impl<'de> Deserialize<'de> for NetworkMetrics
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>,
impl Eq for NetworkMetrics
Source§impl PartialEq for NetworkMetrics
impl PartialEq for NetworkMetrics
Source§impl Serialize for NetworkMetrics
impl Serialize for NetworkMetrics
impl StructuralPartialEq for NetworkMetrics
Auto Trait Implementations§
impl Freeze for NetworkMetrics
impl RefUnwindSafe for NetworkMetrics
impl Send for NetworkMetrics
impl Sync for NetworkMetrics
impl Unpin for NetworkMetrics
impl UnsafeUnpin for NetworkMetrics
impl UnwindSafe for NetworkMetrics
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more