Skip to main content

Metrics

Struct Metrics 

Source
pub struct Metrics { /* private fields */ }
Available on crate feature metrics only.
Expand description

Set of Swarm and protocol metrics derived from emitted events.

Implementations§

Source§

impl Metrics

Source

pub fn new(registry: &mut Registry) -> Metrics

Create a new set of Swarm and protocol Metrics.

use libp2p_metrics::Metrics;
use prometheus_client::registry::Registry;
let mut registry = Registry::default();
let metrics = Metrics::new(&mut registry);

Trait Implementations§

Source§

impl Recorder<Event> for Metrics

Available on crate feature dcutr only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl Recorder<Event> for Metrics

Available on crate feature gossipsub only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl Recorder<Event> for Metrics

Available on crate feature identify only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl Recorder<Event> for Metrics

Available on crate feature kad only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl Recorder<Event> for Metrics

Available on crate feature ping only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl Recorder<Event> for Metrics

Available on crate feature relay only.
Source§

fn record(&self, event: &Event)

Record the given event.
Source§

impl<TBvEv> Recorder<SwarmEvent<TBvEv>> for Metrics

Source§

fn record(&self, event: &SwarmEvent<TBvEv>)

Record the given event.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Metrics

§

impl !UnwindSafe for Metrics

§

impl Forget for Metrics

§

impl Freeze for Metrics
where *const ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>>: Freeze, *const ArcInner<Atomic<u64>> is !null: Freeze, PhantomData<ArcInner<Atomic<u64>>>: Freeze, PhantomData<u64>: Freeze, *const ArcInner<Mutex<HashMap<PeerId, Info>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<PeerId, Info>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>>>: Freeze, *const ArcInner<Mutex<RawMutex, Inner>> is !null: Freeze, PhantomData<ArcInner<Mutex<RawMutex, Inner>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>>>: Freeze, *const ArcInner<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>> is !null: Freeze, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>>>: Freeze, *const ArcInner<Mutex<HashMap<ConnectionId, Instant>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<ConnectionId, Instant>>>>: Freeze,

§

impl Move for Metrics

§

impl Send for Metrics
where Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Send, Arc<Atomic<u64>>: Send, Arc<Mutex<HashMap<PeerId, Info>>>: Send, Arc<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>>: Send, Arc<Mutex<RawMutex, Inner>>: Send, Arc<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>>: Send, Arc<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>>: Send, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>>: Send, Arc<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>>: Send, Arc<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>>: Send, Arc<Mutex<HashMap<ConnectionId, Instant>>>: Send,

§

impl Sync for Metrics
where Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Sync, Arc<Atomic<u64>>: Sync, Arc<Mutex<HashMap<PeerId, Info>>>: Sync, Arc<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>>: Sync, Arc<Mutex<RawMutex, Inner>>: Sync, Arc<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>>: Sync, Arc<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>>: Sync, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>>: Sync, Arc<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>>: Sync, Arc<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>>: Sync, Arc<Mutex<HashMap<ConnectionId, Instant>>>: Sync,

§

impl Unpin for Metrics
where Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Unpin, Arc<Atomic<u64>>: Unpin, Arc<Mutex<HashMap<PeerId, Info>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>>: Unpin, Arc<Mutex<RawMutex, Inner>>: Unpin, Arc<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>>: Unpin, Arc<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>>: Unpin, Arc<Mutex<HashMap<ConnectionId, Instant>>>: Unpin,

§

impl UnsafeUnpin for Metrics
where *const ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<Atomic<u64>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u64>>>: UnsafeUnpin, PhantomData<u64>: UnsafeUnpin, *const ArcInner<Mutex<HashMap<PeerId, Info>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<PeerId, Info>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetRecordResult, Counter>>>>: UnsafeUnpin, *const ArcInner<Mutex<RawMutex, Inner>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<RawMutex, Inner>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetClosestPeersResult, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<GetProvidersResult, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<QueryResult, Histogram>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<RoutingUpdated, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<InboundRequest, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<FailureLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<EventLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<AddressLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<IncomingConnectionErrorLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionLabels, Histogram>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<ConnectionClosedLabels, Histogram>>>>: UnsafeUnpin, *const ArcInner<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<RawRwLock, HashMap<OutgoingConnectionErrorLabels, Counter>>>>: UnsafeUnpin, *const ArcInner<Mutex<HashMap<ConnectionId, Instant>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<ConnectionId, Instant>>>>: UnsafeUnpin,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more