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§
source§impl Metrics
impl Metrics
sourcepub fn dump_historical(&self) -> Vec<MetricRecord, Global>
pub fn dump_historical(&self) -> Vec<MetricRecord, Global>
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,
gossip_type: GossipModuleType
)where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_initiate<'a, T, I>( &mut self, remote_agent_list: I, gossip_type: GossipModuleType )where T: Into<AgentLike<'a>>, I: IntoIterator<Item = T>,
Record a gossip round has been initiated by us.
sourcepub fn record_accept<'a, T, I>(
&mut self,
remote_agent_list: I,
gossip_type: GossipModuleType
)where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_accept<'a, T, I>( &mut self, remote_agent_list: I, gossip_type: GossipModuleType )where T: Into<AgentLike<'a>>, I: IntoIterator<Item = T>,
Record a gossip round has been initiated by a peer.
sourcepub fn record_success<'a, T, I>(
&mut self,
remote_agent_list: I,
gossip_type: GossipModuleType
)where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_success<'a, T, I>( &mut self, remote_agent_list: I, gossip_type: GossipModuleType )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,
gossip_type: GossipModuleType
)where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn record_error<'a, T, I>( &mut self, remote_agent_list: I, gossip_type: GossipModuleType )where T: Into<AgentLike<'a>>, I: IntoIterator<Item = T>,
Record a gossip round has finished with an error.
sourcepub fn update_current_round(
&mut self,
peer: &Arc<[u8; 32], Global>,
gossip_type: GossipModuleType,
round_state: &RoundState
)
pub fn update_current_round( &mut self, peer: &Arc<[u8; 32], Global>, gossip_type: GossipModuleType, round_state: &RoundState )
Update node-level info about a current round, or create one if it doesn’t exist
sourcepub fn complete_current_round(
&mut self,
node: &Arc<[u8; 32], Global>,
error: bool
)
pub fn complete_current_round( &mut self, node: &Arc<[u8; 32], Global>, error: bool )
Remove the current round info once it’s complete, and put it into the history list
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<&RoundMetric>where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn last_success<'a, T, I>( &self, remote_agent_list: I ) -> Option<&RoundMetric>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) -> boolwhere
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn is_current_round<'a, T, I>(&self, remote_agent_list: I) -> boolwhere 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) -> f32where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn reachability_quotient<'a, T, I>(&self, remote_agent_list: I) -> f32where 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) -> f32where
T: Into<AgentLike<'a>>,
I: IntoIterator<Item = T>,
pub fn latency_micros<'a, T, I>(&self, remote_agent_list: I) -> f32where T: Into<AgentLike<'a>>, I: IntoIterator<Item = T>,
Return the average (mean) latency microseconds for the supplied remote agents.
sourcepub fn peer_agent_histories(
&self
) -> &HashMap<Arc<KitsuneAgent, Global>, PeerAgentHistory, RandomState>
pub fn peer_agent_histories( &self ) -> &HashMap<Arc<KitsuneAgent, Global>, PeerAgentHistory, RandomState>
Getter
sourcepub fn peer_node_histories(
&self
) -> &HashMap<Arc<[u8; 32], Global>, PeerNodeHistory, RandomState>
pub fn peer_node_histories( &self ) -> &HashMap<Arc<[u8; 32], Global>, PeerNodeHistory, RandomState>
Getter
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.