Skip to main content

Recorder

Struct Recorder 

Source
pub struct Recorder {
Show 19 fields framers_created: AtomicU64, framer_header_polls: AtomicU64, framer_object_polls: AtomicU64, control_parsers_created: AtomicU64, datagram_headers_decoded: AtomicU64, egress_items_queued: AtomicU64, objects_elided: AtomicU64, object_ids_rewritten: AtomicU64, units_delayed: AtomicU64, objects_truncated: AtomicU64, actions_refused: AtomicU64, streams_not_shapeable: AtomicU64, objects_not_addressable: AtomicU64, control_frames_not_decodable: AtomicU64, release_error_ns: AtomicU64, release_count: AtomicU64, release_max_ns: AtomicU64, release_hist: [AtomicU32; 128], coarse_timer_reported: AtomicBool,
}
Expand description

Session-scoped counter storage.

One per ProxySession, shared by that session’s forwarding tasks through Arc (ForwardCtx is #[derive(Clone)] and cloned per task, session.rs:191-229), so concurrently running sessions in one test binary cannot see each other’s increments. That is what makes objects_elided == 0 assertable at all.

Storage is atomics plus a [AtomicU32; 128] histogram — 512 bytes per session. A release sample costs four relaxed atomic operations (sum, count, max, one bucket) on a path that already did a write_all; every other counter costs one.

Fields§

§framers_created: AtomicU64§framer_header_polls: AtomicU64§framer_object_polls: AtomicU64§control_parsers_created: AtomicU64§datagram_headers_decoded: AtomicU64§egress_items_queued: AtomicU64§objects_elided: AtomicU64§object_ids_rewritten: AtomicU64§units_delayed: AtomicU64§objects_truncated: AtomicU64§actions_refused: AtomicU64§streams_not_shapeable: AtomicU64§objects_not_addressable: AtomicU64§control_frames_not_decodable: AtomicU64§release_error_ns: AtomicU64§release_count: AtomicU64§release_max_ns: AtomicU64§release_hist: [AtomicU32; 128]§coarse_timer_reported: AtomicBool

Implementations§

Source§

impl Recorder

Source

pub fn new() -> Self

A recorder with every counter at zero.

Source

pub fn snapshot(&self) -> Counters

Snapshot every counter for this session.

Source

pub(crate) fn record_release(&self, late: Duration)

Record one deferred release’s lateness.

Call sites: the release arm of the egress select!, once per unit pop_due yields, with now.saturating_duration_since(release_at). Units written inline and units flushed by a drain that ignores release times are not samples — recording them would dilute the distribution with zeros and report teardown as a timing failure.

Source

pub(crate) fn claim_coarse_timer_report(&self) -> bool

true the first time it is called, false after — a swap(true) on an AtomicBool, so “once per session” holds across the session’s five concurrent forwarding tasks without a lock.

Source

pub(crate) fn note_framer_created(&self)

One ObjectFramer was constructed. framer.rs, both constructors.

Source

pub(crate) fn note_framer_header_poll(&self)

ObjectFramer::poll_header was entered.

Source

pub(crate) fn note_framer_object_poll(&self)

ObjectFramer::poll_object was entered.

Source

pub(crate) fn note_control_parser_created(&self)

A ControlStreamParser was constructed. session.rs, behind control_parse.

Source

pub(crate) fn note_datagram_header_decoded(&self)

An AnyDatagramHeader::decode call site was entered.

Source

pub(crate) fn note_egress_item_queued(&self)

One unit was pushed onto a per-stream pending queue. egress.rs.

Source

pub(crate) fn note_object_elided(&self)

One object was removed by DropMode::Elide.

Source

pub(crate) fn note_object_id_rewritten(&self)

One elide fix-up was written: a leading Object ID varint on a subgroup stream, a re-encoded framing on a fetch stream.

Source

pub(crate) fn note_unit_delayed(&self)

One unit was deferred by Action::Delay. Counted at the decision, so a unit still queued when the session ends is already in it.

Source

pub(crate) fn note_object_truncated(&self)

One object was cut short by Action::Truncate. Applied truncations only — a refused attempt is actions_refused.

Source

pub(crate) fn note_action_refused(&self)

One action attempt was refused. Counted per attempt, not per stream.

Source

pub(crate) fn note_stream_not_shapeable(&self)

The framer stopped parsing one stream — one latched bypass.

Source

pub(crate) fn note_object_not_addressable(&self)

One object was streamed through without being addressable. The running total behind ImpairmentKind::ObjectNotAddressable, which is emitted once per stream — so this counter and that event count different things on purpose.

Source

pub(crate) fn note_control_frames_not_decodable(&self, n: u64)

n control frames were stepped over because the decoder refused them. session.rs, after any feed that raised the parser’s running count.

Takes a count where every neighbour takes none. ControlStreamParser reports a cumulative figure rather than an edge, and one feed can refuse several frames, so the caller passes the difference: three refusals in one chunk are three here and one ImpairmentKind::ControlFrameNotDecodable. A += 1 per call would have made the counter agree with the event and disagree with the traffic, which is the wrong one of the two to match.

Trait Implementations§

Source§

impl Debug for Recorder

Source§

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

Prints the snapshot, not 128 histogram slots.

Source§

impl Default for Recorder

Source§

fn default() -> Self

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

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

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