pub struct Metrics { /* private fields */ }
Expand description

A collection of metrics used throughout the Gossipsub behaviour.

Implementations§

source§

impl Metrics

source

pub fn new(registry: &mut Registry, config: Config) -> Self

source

pub fn set_topic_peers(&mut self, topic: &TopicHash, count: usize)

Register how many peers do we known are subscribed to this topic.

source

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.

source

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.

source

pub fn peers_included( &mut self, topic: &TopicHash, reason: Inclusion, count: usize )

Register the inclusion of peers in our mesh due to some reason.

source

pub fn peers_removed(&mut self, topic: &TopicHash, reason: Churn, count: usize)

Register the removal of peers in our mesh due to some reason.

source

pub fn set_mesh_peers(&mut self, topic: &TopicHash, count: usize)

Register the current number of peers in our mesh for this topic.

source

pub fn register_invalid_message(&mut self, topic: &TopicHash)

Register that an invalid message was received on a specific topic.

source

pub fn register_score_penalty(&mut self, penalty: Penalty)

Register a score penalty.

source

pub fn register_published_message(&mut self, topic: &TopicHash)

Registers that a message was published on a specific topic.

source

pub fn msg_sent(&mut self, topic: &TopicHash, bytes: usize)

Register sending a message over a topic.

source

pub fn msg_recvd(&mut self, topic: &TopicHash)

Register that a message was received (and was not a duplicate).

source

pub fn msg_recvd_unfiltered(&mut self, topic: &TopicHash, bytes: usize)

Register that a message was received (could have been a duplicate).

source

pub fn register_msg_validation( &mut self, topic: &TopicHash, validation: &MessageAcceptance )

source

pub fn memcache_miss(&mut self)

Register a memcache miss.

source

pub fn register_iwant(&mut self, topic: &TopicHash)

Register sending an IWANT msg for this topic.

source

pub fn observe_heartbeat_duration(&mut self, millis: u64)

Observes a heartbeat duration.

source

pub fn observe_mesh_peers_score(&mut self, topic: &TopicHash, score: f64)

Observe a score of a mesh peer.

source

pub fn peer_protocol_connected(&mut self, kind: PeerKind)

Register a new peers connection based on its protocol.

source

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§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V