Skip to main content

RuntimeMetrics

Struct RuntimeMetrics 

Source
pub struct RuntimeMetrics {
    pub resync_count: u64,
    pub seq_gaps: u64,
    pub unknown_orders: u64,
    pub unknown_resolved_ms: u64,
    pub rate_limit_hits: u64,
    pub rate_limit_by_bucket: Vec<(String, u64)>,
    pub buffer_conflated: u64,
    pub buffer_dropped: u64,
    pub buffer_overflow: u64,
    pub egress_latency_p50_ms: Duration,
    pub egress_latency_p99_ms: Duration,
}
Expand description

A plain set of counters about the connector runtime.

It is a snapshot-style struct for the owner to fill and read. The runtime does not update it by itself and there is no exporter. All counts start at zero and only grow.

§Examples

use brokapi_runtime::RuntimeMetrics;

let mut m = RuntimeMetrics::new();
m.record_rate_limit("orders");
m.record_rate_limit("orders");
m.record_rate_limit("global");
assert_eq!(m.rate_limit_hits, 3);
assert_eq!(m.rate_limit_by_bucket, vec![("orders".to_string(), 2), ("global".to_string(), 1)]);

Fields§

§resync_count: u64

Number of resyncs recorded with record_resync.

§seq_gaps: u64

Number of sequence gaps recorded with record_seq_gap.

§unknown_orders: u64

Number of orders that entered the Unknown state. The owner counts them, no method here does.

§unknown_resolved_ms: u64

Milliseconds spent resolving Unknown orders. The owner decides how to sum it, the runtime does not fill it.

§rate_limit_hits: u64

Number of calls refused by the rate limiter.

§rate_limit_by_bucket: Vec<(String, u64)>

The same refusals split by bucket name, in order of first appearance.

§buffer_conflated: u64

Events replaced by newer ones in Conflate buffers, added with record_conflated.

§buffer_dropped: u64

Events thrown away by DropNewest buffers, added with record_dropped.

§buffer_overflow: u64

Overflows of Lossless buffers, counted with record_overflow.

§egress_latency_p50_ms: Duration

Median time from parsing an event to handing it to the consumer. Not filled by the runtime.

§egress_latency_p99_ms: Duration

99th percentile of the same time. Not filled by the runtime.

Implementations§

Source§

impl RuntimeMetrics

Source

pub fn new() -> Self

Creates a zeroed set. Same as Default::default.

Source

pub fn record_resync(&mut self)

Adds one to resync_count.

Source

pub fn record_seq_gap(&mut self)

Adds one to seq_gaps.

Source

pub fn record_rate_limit(&mut self, bucket: &str)

Counts one rate-limit refusal, in total and for bucket.

Source

pub fn record_conflated(&mut self, n: u64)

Adds n to buffer_conflated.

Source

pub fn record_dropped(&mut self, n: u64)

Adds n to buffer_dropped.

Source

pub fn record_overflow(&mut self)

Adds one to buffer_overflow.

Trait Implementations§

Source§

impl Clone for RuntimeMetrics

Source§

fn clone(&self) -> RuntimeMetrics

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeMetrics

Source§

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

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

impl Default for RuntimeMetrics

Source§

fn default() -> RuntimeMetrics

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

impl Eq for RuntimeMetrics

Source§

impl PartialEq for RuntimeMetrics

Source§

fn eq(&self, other: &RuntimeMetrics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RuntimeMetrics

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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.
§

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