Skip to main content

ProxyStats

Struct ProxyStats 

Source
#[non_exhaustive]
pub struct ProxyStats { pub per_leg: [LegStats; 2], pub sessions: SessionStats, pub classes: Vec<ClassStats>, pub default_class: ClassStats, pub unshapeable: ClassStats, }
Expand description

Shaping statistics for a whole proxy: every session it has accepted, including the ones that have already ended.

Read through ProxyControl::stats and cleared through ProxyControl::reset_stats. The figures are cumulative and monotone between resets, which is the property that separates this from ProxyControl::sessions: that list is what is live now and shrinks when a client disconnects, and a total summed from it would shrink with it. Nothing here is ever removed, so a session that ended, errored, or had its whole future dropped mid-flight has already contributed everything it moved.

§Everything here is gated on a configured ShapeProfile

The writers are the shaping path’s, so a proxy running with no profile reports ProxyStats::default() no matter how many gigabytes it forwards. An all-zero snapshot means no profile, not no traffic, and the two are not distinguishable from this type alone — ask ProxyControl::sessions or an observer’s event stream which of the two it is.

§A session driven directly is not in here

A ProxySession constructed by a caller rather than accepted by a proxy belongs to no control plane, so it has nowhere to report and keeps only its own ShapeStats. That is the same rule ProxyControl::sessions follows, and for the same reason: a proxy must not claim traffic it never accepted.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§per_leg: [LegStats; 2]

One row per connection this proxy holds: index 0 is Leg::Client, index 1 is Leg::Upstream. Reach a row by name with ProxyStats::leg rather than by literal index.

A byte crosses both legs — read on one, written on the other — so a figure here is charged where it was measured and the two legs are not two views of one number. See LegStats for the cell by cell statement.

§sessions: SessionStats

The flat rollup over every session, derived at snapshot time from Self::per_leg and the class rows rather than accumulated into counters of its own.

Derived for the reason a session’s own snapshot sums its two legs: two independently written counters can disagree, and the disagreement surfaces as an identity that fails for no reason a reader could act on. A sum taken at read time cannot drift from its parts, which also means the rollup identity is a property of this type’s shape and not something a test could ever falsify.

§classes: Vec<ClassStats>

One entry per class, in ShapeProfile::classes order.

Sized once, from the first session this proxy accepts that has a class to install — a session with no profile, and a session whose profile declares no classes, both leave the rows alone — and never resized: a Class::Rule(index) is an index into the class list its own scheduler was built from, so a row set that changed shape under a running session would relabel every figure in it. A session whose class list does not match, which is what a live ProxyControl::set_shape with a different set of classes produces, charges Self::default_class instead of a row that would be named for somebody else’s rule.

§default_class: ClassStats

Units that matched no rule — and units of a session whose class list this proxy’s rows were not sized for, for the reason Self::classes gives.

§unshapeable: ClassStats

Units no rule could have seen: stream headers, oversized passthrough objects, bypassed streams. A separate row from Self::default_class for the reason ShapeStats::unshapeable gives.

Implementations§

Source§

impl ProxyStats

Source

pub fn leg(&self, leg: Leg) -> &LegStats

One leg’s row, by name.

Self::per_leg is an array so the data path can charge a cell at a known offset; a reader should not have to remember which offset that is, and an index literal at a call site is exactly the kind of mistake that reads plausibly forever.

Trait Implementations§

Source§

impl Clone for ProxyStats

Source§

fn clone(&self) -> ProxyStats

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 ProxyStats

Source§

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

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

impl Default for ProxyStats

Source§

fn default() -> ProxyStats

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

impl Eq for ProxyStats

Source§

impl PartialEq for ProxyStats

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProxyStats

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
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> 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 = !

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