pub struct Core { /* private fields */ }
Available on crate feature
static_core
only.Expand description
Core is the base metrics struct.
It manages the mapping between the metrics name and the actual metrics. It also carries a single prometheus registry to be used by all metrics.
Implementations§
Source§impl Core
impl Core
Sourcepub fn init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(f: F)
pub fn init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(f: F)
Must only be called once to init metrics.
Panics if called a second time.
Sourcepub fn try_init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(
f: F,
) -> Result<()>
pub fn try_init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>( f: F, ) -> Result<()>
Trieds to init the metrics.
Sourcepub fn registry(&self) -> &Registry
Available on crate feature metrics
only.
pub fn registry(&self) -> &Registry
metrics
only.Returns a reference to the prometheus registry.
Sourcepub fn get_collector<T: MetricsGroup>(&self) -> Option<&T>
pub fn get_collector<T: MetricsGroup>(&self) -> Option<&T>
Returns a reference to the mapped metrics instance.
Sourcepub fn encode_openmetrics(&self) -> String
Available on crate feature metrics
only.
pub fn encode_openmetrics(&self) -> String
metrics
only.Encodes the current metrics registry to a string in the prometheus text exposition format.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Core
impl !RefUnwindSafe for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl !UnwindSafe for Core
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