#[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
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: SessionStatsThe 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: ClassStatsUnits 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: ClassStatsUnits 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
impl ProxyStats
Sourcepub fn leg(&self, leg: Leg) -> &LegStats
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
impl Clone for ProxyStats
Source§fn clone(&self) -> ProxyStats
fn clone(&self) -> ProxyStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more