relay_system

Struct RuntimeMetrics

source
pub struct RuntimeMetrics { /* private fields */ }
Expand description

Handle to the Runtime’s metrics.

Unlike [tokio::runtime::RuntimeMetrics] this handle returns the relative increase in values since the last time the specific metric was queried.

This makes it possible to emit these metrics as counters more easily through statsd.

It also exposes some other runtime metrics which Tokio does not directly expose through the [tokio::runtime::RuntimeMetrics] handle.

Implementations§

source§

impl RuntimeMetrics

source

pub fn name(&self) -> &'static str

Returns the runtime name.

source

pub fn num_idle_threads(&self) -> usize

Returns the amount of current threads idle.

source

pub fn num_alive_tasks(&self) -> usize

Returns the amount of currently alive tasks in the runtime.

See also: [tokio::runtime::RuntimeMetrics::num_alive_tasks].

source

pub fn blocking_queue_depth(&self) -> usize

Returns the number of tasks currently scheduled in the blocking thread pool, spawned using spawn_blocking.

See also: [tokio::runtime::RuntimeMetrics::blocking_queue_depth].

source

pub fn budget_forced_yield_count(&self) -> u64

Returns the number of times that tasks have been forced to yield back to the scheduler after exhausting their task budgets.

See also: [tokio::runtime::RuntimeMetrics::budget_forced_yield_count]

Returns the difference since the function was last called.

source

pub fn num_blocking_threads(&self) -> usize

Returns the number of additional threads spawned by the runtime.

See also: [tokio::runtime::RuntimeMetrics::num_blocking_threads].

source

pub fn num_idle_blocking_threads(&self) -> usize

Returns the number of idle threads, which have spawned by the runtime for spawn_blocking calls.

See also: [tokio::runtime::RuntimeMetrics::num_idle_blocking_threads].

source

pub fn num_workers(&self) -> usize

Returns the number of worker threads used by the runtime.

See also: [tokio::runtime::RuntimeMetrics::num_workers].

source

pub fn worker_local_queue_depth(&self, worker: usize) -> usize

Returns the number of tasks currently scheduled in the given worker’s local queue.

See also: [tokio::runtime::RuntimeMetrics::worker_local_queue_depth].

source

pub fn worker_mean_poll_time(&self, worker: usize) -> Duration

Returns the mean duration of task polls, in nanoseconds.

See also: [tokio::runtime::RuntimeMetrics::worker_mean_poll_time].

source

pub fn worker_local_schedule_count(&self, worker: usize) -> u64

Returns the number of tasks scheduled from within the runtime on the given worker’s local queue.

See also: [tokio::runtime::RuntimeMetrics::worker_local_schedule_count]

Returns the difference since the function was last called.

source

pub fn worker_noop_count(&self, worker: usize) -> u64

Returns the number of times the given worker thread unparked but performed no work before parking again.

See also: [tokio::runtime::RuntimeMetrics::worker_noop_count]

Returns the difference since the function was last called.

source

pub fn worker_overflow_count(&self, worker: usize) -> u64

Returns the number of times the given worker thread saturated its local queue.

See also: [tokio::runtime::RuntimeMetrics::worker_overflow_count]

Returns the difference since the function was last called.

source

pub fn worker_park_count(&self, worker: usize) -> u64

Returns the total number of times the given worker thread has parked.

See also: [tokio::runtime::RuntimeMetrics::worker_park_count]

Returns the difference since the function was last called.

source

pub fn worker_poll_count(&self, worker: usize) -> u64

Returns the number of tasks the given worker thread has polled.

See also: [tokio::runtime::RuntimeMetrics::worker_poll_count]

Returns the difference since the function was last called.

source

pub fn worker_steal_count(&self, worker: usize) -> u64

Returns the number of tasks the given worker thread stole from another worker thread.

See also: [tokio::runtime::RuntimeMetrics::worker_steal_count]

Returns the difference since the function was last called.

source

pub fn worker_steal_operations(&self, worker: usize) -> u64

Returns the number of times the given worker thread stole tasks from another worker thread.

See also: [tokio::runtime::RuntimeMetrics::worker_steal_operations]

Returns the difference since the function was last called.

source

pub fn worker_total_busy_duration(&self, worker: usize) -> Duration

Returns the amount of time the given worker thread has been busy, in seconds.

See also: [tokio::runtime::RuntimeMetrics::worker_total_busy_duration].

Returns the difference since the function was last called.

Trait Implementations§

source§

impl Debug for RuntimeMetrics

source§

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

Formats the value using the given formatter. 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 = 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.
§

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

§

fn vzip(self) -> V

§

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
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T