pub struct Registry { /* private fields */ }Expand description
Wraps prometheus::Registry with an embedded Filter so that
register_*_with_registry! macros can decide at construction time whether
a metric should be active.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn new_custom(
prefix: Option<String>,
labels: Option<HashMap<String, String>>,
) -> Result<Self>
pub fn new_custom( prefix: Option<String>, labels: Option<HashMap<String, String>>, ) -> Result<Self>
Creates a custom-prefixed registry whose filter is read from the
METRICS_FILTER env var.
Sourcepub fn with_filter(filter_str: &str) -> Self
pub fn with_filter(filter_str: &str) -> Self
Creates a registry using the supplied filter string.
Sourcepub fn is_enabled(&self, name: &str, module: &str) -> bool
pub fn is_enabled(&self, name: &str, module: &str) -> bool
Used by wrapper macros to decide whether to register a metric.
Sourcepub fn inner(&self) -> &Registry
pub fn inner(&self) -> &Registry
Returns the underlying prometheus::Registry for use inside wrapper
macros.
pub fn register(&self, c: Box<dyn Collector>) -> Result<()>
pub fn unregister(&self, c: Box<dyn Collector>) -> Result<()>
pub fn gather(&self) -> Vec<MetricFamily>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more