pub struct MetricsRegistry { /* private fields */ }Expand description
Daemon-scoped metrics registry and collector handles.
Implementations§
Source§impl MetricsRegistry
impl MetricsRegistry
Sourcepub fn new(
metrics_bind: Option<SocketAddr>,
) -> Result<Self, MetricsRegistryError>
pub fn new( metrics_bind: Option<SocketAddr>, ) -> Result<Self, MetricsRegistryError>
Builds a new registry instance and registers all required collector families.
Sourcepub fn bind_address(&self) -> Option<SocketAddr>
pub fn bind_address(&self) -> Option<SocketAddr>
Returns the configured metrics bind address when enabled.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if metrics routing is enabled.
Sourcepub fn collectors(&self) -> &RegisteredMetrics
pub fn collectors(&self) -> &RegisteredMetrics
Returns the collector handle set.
Sourcepub fn gather(&self) -> Vec<MetricFamily>
pub fn gather(&self) -> Vec<MetricFamily>
Gathers metric families from the daemon-local registry.
Sourcepub fn encode_text(&self) -> Result<EncodedMetrics, MetricsRegistryError>
pub fn encode_text(&self) -> Result<EncodedMetrics, MetricsRegistryError>
Encodes gathered metric families to Prometheus text exposition.
Trait Implementations§
Source§impl Clone for MetricsRegistry
impl Clone for MetricsRegistry
Source§fn clone(&self) -> MetricsRegistry
fn clone(&self) -> MetricsRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MetricsRegistry
impl !RefUnwindSafe for MetricsRegistry
impl Send for MetricsRegistry
impl Sync for MetricsRegistry
impl Unpin for MetricsRegistry
impl UnsafeUnpin for MetricsRegistry
impl !UnwindSafe for MetricsRegistry
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