pub struct MetricsPlugin { /* private fields */ }Expand description
Process-wide MetricsPlugin singleton storing MetricsConfig and MetricsRegistry.
Implementations§
Source§impl MetricsPlugin
Inherent implementation of MetricsPlugin.
impl MetricsPlugin
Inherent implementation of MetricsPlugin.
Sourcepub fn init(config: MetricsConfig) -> &'static Self
pub fn init(config: MetricsConfig) -> &'static Self
Initializes the global MetricsPlugin once with config and an automatically created registry.
§Arguments
MetricsConfig- Scrape endpoint, namespace, and optional auth settings.
§Returns
&'static Self- Reference to the initialized global plugin.
Sourcepub fn init_with_registry(
config: MetricsConfig,
registry: MetricsRegistry,
) -> &'static Self
pub fn init_with_registry( config: MetricsConfig, registry: MetricsRegistry, ) -> &'static Self
Initializes the global MetricsPlugin once with config and a pre-created MetricsRegistry.
§Arguments
MetricsConfig- Scrape endpoint and auth settings.MetricsRegistry- Shared metrics registry.
§Returns
&'static Self- Reference to the initialized global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global MetricsPlugin, if initialized.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn get_config(&self) -> &MetricsConfig
pub fn get_config(&self) -> &MetricsConfig
Sourcepub fn get_registry(&self) -> &MetricsRegistry
pub fn get_registry(&self) -> &MetricsRegistry
Trait Implementations§
Auto Trait Implementations§
impl Forget for MetricsPlugin
impl Freeze for MetricsPluginwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<MetricsRegistryInner> is !null: Freeze,
PhantomData<ArcInner<MetricsRegistryInner>>: Freeze,
impl Move for MetricsPlugin
impl RefUnwindSafe for MetricsPluginwhere
Atomic<usize>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
Atomic<i64>: RefUnwindSafe,
RwLock<HashMap<String, RegisteredCounter, BuildHasherDefault<XxHash3_64>>>: RefUnwindSafe,
RwLock<HashMap<String, RegisteredGauge, BuildHasherDefault<XxHash3_64>>>: RefUnwindSafe,
RwLock<HashMap<String, RegisteredHistogram, BuildHasherDefault<XxHash3_64>>>: RefUnwindSafe,
impl Send for MetricsPlugin
impl Sync for MetricsPlugin
impl Unpin for MetricsPlugin
impl UnsafeUnpin for MetricsPluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<MetricsRegistryInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<MetricsRegistryInner>>: UnsafeUnpin,
impl UnwindSafe for MetricsPlugin
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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