Skip to main content

ScopedRegistry

Struct ScopedRegistry 

Source
pub struct ScopedRegistry<'a> { /* private fields */ }
Expand description

View into a Registry that prepends a fixed prefix to every metric name. Created via Registry::scoped.

Available since v0.9.5.

Implementations§

Source§

impl<'a> ScopedRegistry<'a>

Source

pub fn prefix(&self) -> &str

Borrow the prefix this scope prepends.

Source

pub fn registry(&self) -> &'a Registry

Borrow the underlying Registry.

Source

pub fn describe_counter( &self, name: &str, help: impl Into<Cow<'static, str>>, unit: Unit, )

Describe a counter under the scoped name.

Source

pub fn describe_gauge( &self, name: &str, help: impl Into<Cow<'static, str>>, unit: Unit, )

Describe a gauge under the scoped name.

Source

pub fn describe_timer( &self, name: &str, help: impl Into<Cow<'static, str>>, unit: Unit, )

Describe a timer under the scoped name.

Source

pub fn describe_rate( &self, name: &str, help: impl Into<Cow<'static, str>>, unit: Unit, )

Describe a rate meter under the scoped name.

Source

pub fn describe_histogram( &self, name: &str, help: impl Into<Cow<'static, str>>, unit: Unit, )

Describe a histogram under the scoped name.

Source

pub fn counter(&self, name: &str) -> Arc<Counter>

Counter under the scoped name. Requires count.

Source

pub fn gauge(&self, name: &str) -> Arc<Gauge>

Gauge under the scoped name. Requires gauge.

Source

pub fn timer(&self, name: &str) -> Arc<Timer>

Timer under the scoped name. Requires timer.

Source

pub fn counter_with(&self, name: &str, labels: &LabelSet) -> Arc<Counter>

Labeled counter under the scoped name. Requires count.

Source

pub fn gauge_with(&self, name: &str, labels: &LabelSet) -> Arc<Gauge>

Labeled gauge under the scoped name. Requires gauge.

Source

pub fn timer_with(&self, name: &str, labels: &LabelSet) -> Arc<Timer>

Labeled timer under the scoped name. Requires timer.

Source

pub fn scoped(&self, sub_prefix: impl Into<String>) -> ScopedRegistry<'a>

Nested scope: scoped("a.").scoped("b.") is equivalent to scoped("a.b."). Allocates a single fresh String.

Auto Trait Implementations§

§

impl<'a> Freeze for ScopedRegistry<'a>

§

impl<'a> RefUnwindSafe for ScopedRegistry<'a>

§

impl<'a> Send for ScopedRegistry<'a>

§

impl<'a> Sync for ScopedRegistry<'a>

§

impl<'a> Unpin for ScopedRegistry<'a>

§

impl<'a> UnsafeUnpin for ScopedRegistry<'a>

§

impl<'a> UnwindSafe for ScopedRegistry<'a>

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
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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

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.