Skip to main content

Counters

Struct Counters 

Source
pub struct Counters {
    pub shed: ShedCounts,
    pub overload_rejections: u64,
    pub unmatched_responses: u64,
    pub retransmissions_sent: u64,
    pub oversized_request_tcp_fallbacks: u64,
    pub timeouts: TimeoutCounts,
    pub discards: DiscardCounts,
    pub unsent: UnsentCounts,
    pub capture: CaptureCounts,
    pub observation_dropped: u64,
    /* private fields */
}
Expand description

Everything an endpoint will tell you about itself, at one moment (§12).

§What this is not

A snapshot is not an instant. The fields are separate atomics read one after another, so a snapshot taken while traffic flows can show TransportCounts::requests_in from a later moment than TransportCounts::responses_in. Every field is individually monotonic and none is ever lost, so differences between successive snapshots are sound. Arithmetic identities across fields of a single snapshot are not, unless the endpoint is quiet.

See TransportCounts::parse_failures for the one place that surprises people: in and out do not balance, by construction.

Fields§

§shed: ShedCounts

What was dropped because the application was not keeping up (§10).

The same value crate::Handle::shed returns, embedded rather than recounted: two tallies of one event would eventually disagree, and then neither could be trusted.

§overload_rejections: u64

Locally rejected outbound requests under RFC 7339/RFC 7415 control.

§unmatched_responses: u64

Responses that matched no client transaction (RFC 3261 §16.7).

Counted whether or not anyone is watching for them through crate::Handle::watch_unmatched. A user agent is right to ignore these; a forwarding element is required to act on them, and either way the rate is worth knowing.

§retransmissions_sent: u64

Retransmissions put on the wire by Timer A, E or G.

Counted where the timer fires, so a retransmission the socket then refuses is still counted as sent (§12.2). Counting after the socket call would mean a peer that stopped hearing us produced a falling count, inverting the signal this exists to give.

A rise with no matching growth in traffic is a peer that is not hearing us, which is the difference between a network problem and an application one.

§oversized_request_tcp_fallbacks: u64

Oversized UDP requests for which RFC 3261 §18.1.1 selected TCP instead.

Counted at selection, including a selection whose connection attempt then fails. Consult Self::unsent and Self::discards for whether the selected send reached the wire.

§timeouts: TimeoutCounts

Transactions a timer gave up on.

§discards: DiscardCounts

Discards that are not backpressure (§12.1).

§unsent: UnsentCounts

Requests the endpoint tried to put on the wire and could not, by method (§12.3).

Overlaps DiscardCounts::send_failures for requests on the transaction path — see UnsentCounts, which states what that does and does not let you conclude.

§capture: CaptureCounts

How the capture is faring, if one is running (§13).

§observation_dropped: u64

Observation events dropped because the optional bounded consumer was behind.

Implementations§

Source§

impl Counters

Source

pub fn transport(&self, transport: TransportKind) -> TransportCounts

What crossed one transport.

Source

pub fn messages_in(&self) -> u64

Messages that arrived and parsed, over every transport.

Source

pub fn messages_out(&self) -> u64

Messages put on the wire, over every transport.

Source

pub fn parse_failures(&self) -> u64

Everything that arrived and could not be parsed, over every transport.

Source

pub fn any_loss(&self) -> bool

Whether anything at all has been lost: shed, discarded, dropped from a capture, or never put on the wire.

A single question for a health check to ask. Deliberately does not include Self::parse_failures or Self::timeouts: a malformed datagram from a stranger and a peer that stopped answering are things that happened to the endpoint, not things it threw away, and folding them in here would make the number impossible to act on.

Trait Implementations§

Source§

impl Clone for Counters

Source§

fn clone(&self) -> Counters

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Counters

Source§

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

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

impl Default for Counters

Source§

fn default() -> Counters

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

impl PartialEq for Counters

Source§

fn eq(&self, other: &Counters) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Counters

Source§

impl Eq for Counters

Source§

impl StructuralPartialEq for Counters

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,