Skip to main content

NodeMetrics

Struct NodeMetrics 

Source
#[non_exhaustive]
pub struct NodeMetrics { /* private fields */ }
Expand description

Per node metrics aggregated by fixed and dynamic collectors.

These metrics are updated via the Telemetry trait and represent simple counters and latency aggregates.

Implementations§

Source§

impl NodeMetrics

Source

pub const fn new() -> Self

Create a new zero initialized metrics record.

Source

pub const fn processed(&self) -> &u64

Returns the number of items successfully processed by the node.

Source

pub const fn dropped(&self) -> &u64

Returns the number of items dropped by the node.

Source

pub const fn ingress(&self) -> &u64

Returns the number of ingress messages observed by the node.

Source

pub const fn egress(&self) -> &u64

Returns the number of egress messages emitted by the node.

Source

pub const fn lat_sum(&self) -> &u64

Returns the sum of all recorded latencies in nanoseconds.

Source

pub const fn lat_cnt(&self) -> &u64

Returns the number of latency samples recorded.

Source

pub const fn lat_max(&self) -> &u64

Returns the maximum latency observed in nanoseconds.

Source

pub const fn deadline_miss_count(&self) -> &u64

Returns the number of deadline misses observed for this node.

Source

pub fn inc_processed(&mut self, delta: u64)

Increment processed by delta (saturating).

Source

pub fn dec_processed(&mut self, delta: u64)

Subtract from processed (saturating at zero).

Source

pub fn set_processed(&mut self, v: u64)

Set processed to v.

Source

pub fn inc_dropped(&mut self, delta: u64)

Increment dropped by delta (saturating).

Source

pub fn dec_dropped(&mut self, delta: u64)

Subtract from dropped (saturating at zero).

Source

pub fn set_dropped(&mut self, v: u64)

Set dropped to v.

Source

pub fn inc_ingress(&mut self, delta: u64)

Increment ingress by delta (saturating).

Source

pub fn dec_ingress(&mut self, delta: u64)

Subtract from ingress (saturating at zero).

Source

pub fn set_ingress(&mut self, v: u64)

Set ingress to v.

Source

pub fn inc_egress(&mut self, delta: u64)

Increment egress by delta (saturating).

Source

pub fn dec_egress(&mut self, delta: u64)

Subtract from egress (saturating at zero).

Source

pub fn set_egress(&mut self, v: u64)

Set egress to v.

Source

pub fn record_latency_ns(&mut self, value_ns: u64)

Record a latency sample in nanoseconds.

This updates lat_sum, lat_cnt, and lat_max. Uses saturating addition to avoid overflow on long running systems.

Source

pub fn merge_from(&mut self, other: &Self)

Merge another NodeMetrics into self. This uses saturating addition for counters and takes the maximum for latency max.

Source

pub fn inc_deadline_miss_count(&mut self, delta: u64)

Increment the deadline miss counter by delta (saturating).

Source

pub fn reset(&mut self)

Reset all counters and aggregates to zero.

Trait Implementations§

Source§

impl Clone for NodeMetrics

Source§

fn clone(&self) -> NodeMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeMetrics

Source§

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

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

impl Default for NodeMetrics

Source§

fn default() -> Self

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

impl Copy for NodeMetrics

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, 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 = 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.