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
impl ActorMetrics
pub fn new() -> Self
Sourcepub fn record_turn(&self, high_depth: usize, low_depth: usize)
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.
Sourcepub fn record_priority_choice(&self, took_high: bool, low_queued: usize)
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.
pub fn record_hold(&self, kind: CommandKind, held: Duration)
Sourcepub fn snapshot(&self) -> MetricsSnapshot
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
impl Debug for ActorMetrics
Source§impl Default for ActorMetrics
impl Default for ActorMetrics
Source§fn default() -> ActorMetrics
fn default() -> ActorMetrics
Auto Trait Implementations§
impl !Freeze for ActorMetrics
impl RefUnwindSafe for ActorMetrics
impl Send for ActorMetrics
impl Sync for ActorMetrics
impl Unpin for ActorMetrics
impl UnsafeUnpin for ActorMetrics
impl UnwindSafe for ActorMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request