Struct libp2p_gossipsub::metrics::Metrics
source · [−]pub struct Metrics { /* private fields */ }
Expand description
A collection of metrics used throughout the Gossipsub behaviour.
Implementations
sourceimpl Metrics
impl Metrics
pub fn new(registry: &mut Registry, config: Config) -> Self
sourcepub fn set_topic_peers(&mut self, topic: &TopicHash, count: usize)
pub fn set_topic_peers(&mut self, topic: &TopicHash, count: usize)
Register how many peers do we known are subscribed to this topic.
sourcepub fn joined(&mut self, topic: &TopicHash)
pub fn joined(&mut self, topic: &TopicHash)
Registers the subscription to a topic if the configured limits allow it. Sets the registered number of peers in the mesh to 0.
sourcepub fn left(&mut self, topic: &TopicHash)
pub fn left(&mut self, topic: &TopicHash)
Registers the unsubscription to a topic if the topic was previously allowed. Sets the registered number of peers in the mesh to 0.
sourcepub fn peers_included(
&mut self,
topic: &TopicHash,
reason: Inclusion,
count: usize
)
pub fn peers_included(
&mut self,
topic: &TopicHash,
reason: Inclusion,
count: usize
)
Register the inclusion of peers in our mesh due to some reason.
sourcepub fn peers_removed(&mut self, topic: &TopicHash, reason: Churn, count: usize)
pub fn peers_removed(&mut self, topic: &TopicHash, reason: Churn, count: usize)
Register the removal of peers in our mesh due to some reason.
sourcepub fn set_mesh_peers(&mut self, topic: &TopicHash, count: usize)
pub fn set_mesh_peers(&mut self, topic: &TopicHash, count: usize)
Register the current number of peers in our mesh for this topic.
sourcepub fn register_invalid_message(&mut self, topic: &TopicHash)
pub fn register_invalid_message(&mut self, topic: &TopicHash)
Register that an invalid message was received on a specific topic.
sourcepub fn register_score_penalty(&mut self, penalty: Penalty)
pub fn register_score_penalty(&mut self, penalty: Penalty)
Register a score penalty.
sourcepub fn register_published_message(&mut self, topic: &TopicHash)
pub fn register_published_message(&mut self, topic: &TopicHash)
Registers that a message was published on a specific topic.
sourcepub fn msg_sent(&mut self, topic: &TopicHash, bytes: usize)
pub fn msg_sent(&mut self, topic: &TopicHash, bytes: usize)
Register sending a message over a topic.
sourcepub fn msg_recvd(&mut self, topic: &TopicHash)
pub fn msg_recvd(&mut self, topic: &TopicHash)
Register that a message was received (and was not a duplicate).
sourcepub fn msg_recvd_unfiltered(&mut self, topic: &TopicHash, bytes: usize)
pub fn msg_recvd_unfiltered(&mut self, topic: &TopicHash, bytes: usize)
Register that a message was received (could have been a duplicate).
pub fn register_msg_validation(
&mut self,
topic: &TopicHash,
validation: &MessageAcceptance
)
sourcepub fn memcache_miss(&mut self)
pub fn memcache_miss(&mut self)
Register a memcache miss.
sourcepub fn register_iwant(&mut self, topic: &TopicHash)
pub fn register_iwant(&mut self, topic: &TopicHash)
Register sending an IWANT msg for this topic.
sourcepub fn observe_heartbeat_duration(&mut self, millis: u64)
pub fn observe_heartbeat_duration(&mut self, millis: u64)
Observes a heartbeat duration.
sourcepub fn observe_mesh_peers_score(&mut self, topic: &TopicHash, score: f64)
pub fn observe_mesh_peers_score(&mut self, topic: &TopicHash, score: f64)
Observe a score of a mesh peer.
sourcepub fn peer_protocol_connected(&mut self, kind: PeerKind)
pub fn peer_protocol_connected(&mut self, kind: PeerKind)
Register a new peers connection based on its protocol.
sourcepub fn peer_protocol_disconnected(&mut self, kind: PeerKind)
pub fn peer_protocol_disconnected(&mut self, kind: PeerKind)
Removes a peer from the counter based on its protocol when it disconnects.
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