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: u64Number of resyncs recorded with record_resync.
seq_gaps: u64Number of sequence gaps recorded with record_seq_gap.
unknown_orders: u64Number of orders that entered the Unknown state. The owner counts them, no method here does.
unknown_resolved_ms: u64Milliseconds spent resolving Unknown orders. The owner decides how to sum it, the runtime
does not fill it.
rate_limit_hits: u64Number 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: u64Events replaced by newer ones in Conflate buffers, added with record_conflated.
buffer_dropped: u64Events thrown away by DropNewest buffers, added with record_dropped.
buffer_overflow: u64Overflows of Lossless buffers, counted with record_overflow.
egress_latency_p50_ms: DurationMedian time from parsing an event to handing it to the consumer. Not filled by the runtime.
egress_latency_p99_ms: Duration99th percentile of the same time. Not filled by the runtime.
Implementations§
Source§impl RuntimeMetrics
impl RuntimeMetrics
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a zeroed set. Same as Default::default.
Sourcepub fn record_resync(&mut self)
pub fn record_resync(&mut self)
Adds one to resync_count.
Sourcepub fn record_seq_gap(&mut self)
pub fn record_seq_gap(&mut self)
Adds one to seq_gaps.
Sourcepub fn record_rate_limit(&mut self, bucket: &str)
pub fn record_rate_limit(&mut self, bucket: &str)
Counts one rate-limit refusal, in total and for bucket.
Sourcepub fn record_conflated(&mut self, n: u64)
pub fn record_conflated(&mut self, n: u64)
Adds n to buffer_conflated.
Sourcepub fn record_dropped(&mut self, n: u64)
pub fn record_dropped(&mut self, n: u64)
Adds n to buffer_dropped.
Sourcepub fn record_overflow(&mut self)
pub fn record_overflow(&mut self)
Adds one to buffer_overflow.
Trait Implementations§
Source§impl Clone for RuntimeMetrics
impl Clone for RuntimeMetrics
Source§fn clone(&self) -> RuntimeMetrics
fn clone(&self) -> RuntimeMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeMetrics
impl Debug for RuntimeMetrics
Source§impl Default for RuntimeMetrics
impl Default for RuntimeMetrics
Source§fn default() -> RuntimeMetrics
fn default() -> RuntimeMetrics
impl Eq for RuntimeMetrics
Source§impl PartialEq for RuntimeMetrics
impl PartialEq for RuntimeMetrics
Source§fn eq(&self, other: &RuntimeMetrics) -> bool
fn eq(&self, other: &RuntimeMetrics) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RuntimeMetrics
Auto Trait Implementations§
impl Freeze for RuntimeMetrics
impl RefUnwindSafe for RuntimeMetrics
impl Send for RuntimeMetrics
impl Sync for RuntimeMetrics
impl Unpin for RuntimeMetrics
impl UnsafeUnpin for RuntimeMetrics
impl UnwindSafe for RuntimeMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.