Skip to main content

ActorMetrics

Struct ActorMetrics 

Source
pub struct ActorMetrics { /* private fields */ }
Expand description

Live counters, shared between the actor and the handle.

Fixed size, no allocation, no lock. The actor updates; anyone may read.

Implementations§

Source§

impl ActorMetrics

Source

pub fn new() -> Self

Source

pub fn record_turn(&self, high_depth: usize, low_depth: usize)

Sample both queue depths. Called before the turn, not after: after the turn the queue reflects what arrived during it, which is a different and much less useful quantity.

Source

pub fn record_priority_choice(&self, took_high: bool, low_queued: usize)

Record which tier the select! chose, and what was waiting.

low_queued is the depth sampled before the select!, so it is the backlog the turn found on arrival. By the time a high-priority arm fires the low queue may have grown; using the pre-select reading keeps this consistent with every other depth figure in this module and makes the counter conservative — it never invents starvation from work that arrived after the choice was made.

A low-priority turn resets the run rather than decrementing it: the question is “how many turns did one low-priority command wait”, and that is a run length, not a balance.

Source

pub fn record_hold(&self, kind: CommandKind, held: Duration)

Source

pub fn snapshot(&self) -> MetricsSnapshot

A consistent-enough picture for a dashboard.

Not a torn-read-free snapshot, and it does not pretend to be: the actor keeps running while this walks the array, so two kinds may be read one turn apart. Locking the actor to produce a report would make the observer a source of the latency it is measuring.

Trait Implementations§

Source§

impl Debug for ActorMetrics

Source§

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

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

impl Default for ActorMetrics

Source§

fn default() -> ActorMetrics

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

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