[][src]Struct open_metrics_client::registry::Registry

pub struct Registry<M> { /* fields omitted */ }

A metric registry to register metrics with, later on passed to an encoder collecting samples of each metric by iterating all metrics in the registry.

let mut registry = Registry::<Box<dyn EncodeMetric>>::new();
let counter = Counter::<AtomicU64>::new();
let gauge= Gauge::<AtomicU64>::new();
registry.register(
  Descriptor::new("counter", "This is my counter.", "my_counter"),
  Box::new(counter.clone()),
);
registry.register(
  Descriptor::new("gauge", "This is my gauge.", "my_gauge"),
  Box::new(gauge.clone()),
);

Implementations

impl<M> Registry<M>[src]

pub fn new() -> Self[src]

pub fn register(&mut self, desc: Descriptor, metric: M)[src]

pub fn iter(&self) -> impl Iterator<Item = &(Descriptor, M)>[src]

Auto Trait Implementations

impl<M> RefUnwindSafe for Registry<M> where
    M: RefUnwindSafe
[src]

impl<M> Send for Registry<M> where
    M: Send
[src]

impl<M> Sync for Registry<M> where
    M: Sync
[src]

impl<M> Unpin for Registry<M> where
    M: Unpin
[src]

impl<M> UnwindSafe for Registry<M> where
    M: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.