pub struct CollectorRegistry { /* private fields */ }Expand description
A collection of metric collectors
Implementations§
Source§impl CollectorRegistry
impl CollectorRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new collector registry for managing multiple metric collectors
The registry provides thread-safe storage and retrieval of metric collectors, allowing different components of the system to register their own collectors.
§Example
ⓘ
let registry = CollectorRegistry::new();
let collector = Arc::new(MetricCollector::new("orders".into(), config));
registry.register(collector);Sourcepub fn register(&self, collector: Arc<MetricCollector>)
pub fn register(&self, collector: Arc<MetricCollector>)
Register a collector
Sourcepub fn collectors(&self) -> Vec<Arc<MetricCollector>>
pub fn collectors(&self) -> Vec<Arc<MetricCollector>>
Get all collectors
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CollectorRegistry
impl !RefUnwindSafe for CollectorRegistry
impl Send for CollectorRegistry
impl Sync for CollectorRegistry
impl Unpin for CollectorRegistry
impl !UnwindSafe for CollectorRegistry
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