Struct kitsune_p2p::metrics::Metrics
source · [−]pub struct Metrics { /* private fields */ }
Expand description
Metrics tracking for remote nodes to help choose which remote node to initiate the next round with.
Implementations
sourceimpl Metrics
impl Metrics
sourcepub fn dump_historical(&self) -> Vec<MetricRecord>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn dump_historical(&self) -> Vec<MetricRecord>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Dump historical metrics for recording to db.
sourcepub fn record_extrap_cov_event(&mut self, extrap_cov: f32)
pub fn record_extrap_cov_event(&mut self, extrap_cov: f32)
Record an individual extrapolated coverage event (either from us or a remote) and add it to our running aggregate extrapolated coverage metric.
sourcepub fn record_reachability_event<'a, T, I>(
&mut self,
success: bool,
remote_agent_list: I
) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_reachability_event<'a, T, I>(
&mut self,
success: bool,
remote_agent_list: I
) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Sucessful and unsuccessful messages from the remote
can be combined to estimate a “reachability quotient”
between 1 (or 0 if empty) and 100. Errors are weighted
heavier because we retry less frequently.
Call this to register a reachability event.
Note, record_success
and record_error
below invoke this
function internally, you don’t need to call it again.
sourcepub fn record_latency_micros<'a, T, I, V>(
&mut self,
micros: V,
remote_agent_list: I
) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
V: AsPrimitive<f32>,
pub fn record_latency_micros<'a, T, I, V>(
&mut self,
micros: V,
remote_agent_list: I
) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
V: AsPrimitive<f32>,
Running average for latency microseconds for any direct request/response calls to remote agent.
sourcepub fn record_initiate<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_initiate<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Record a gossip round has been initiated by us.
sourcepub fn record_remote_round<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_remote_round<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Record a remote gossip round has started.
sourcepub fn record_success<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_success<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Record a gossip round has completed successfully.
sourcepub fn record_error<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_error<'a, T, I>(&mut self, remote_agent_list: I) where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Record a gossip round has finished with an error.
sourcepub fn record_force_initiate(&mut self)
pub fn record_force_initiate(&mut self)
Record that we should force initiate the next few rounds.
sourcepub fn last_success<'a, T, I>(&self, remote_agent_list: I) -> Option<&Instant> where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn last_success<'a, T, I>(&self, remote_agent_list: I) -> Option<&Instant> where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Get the last successful round time.
sourcepub fn is_current_round<'a, T, I>(&self, remote_agent_list: I) -> bool where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn is_current_round<'a, T, I>(&self, remote_agent_list: I) -> bool where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Is this node currently in an active round?
sourcepub fn last_outcome<'a, T, I>(
&self,
remote_agent_list: I
) -> Option<RoundOutcome> where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn last_outcome<'a, T, I>(
&self,
remote_agent_list: I
) -> Option<RoundOutcome> where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
What was the last outcome for this node’s gossip round?
sourcepub fn forced_initiate(&self) -> bool
pub fn forced_initiate(&self) -> bool
Should we force initiate the next round?
sourcepub fn reachability_quotient<'a, T, I>(&self, remote_agent_list: I) -> f32 where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn reachability_quotient<'a, T, I>(&self, remote_agent_list: I) -> f32 where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Return the average (mean) reachability quotient for the supplied remote agents.
sourcepub fn latency_micros<'a, T, I>(&self, remote_agent_list: I) -> f32 where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn latency_micros<'a, T, I>(&self, remote_agent_list: I) -> f32 where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
Return the average (mean) latency microseconds for the supplied remote agents.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnwindSafe for Metrics
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more