pub struct Metrics { /* private fields */ }Expand description
Holds the Prometheus render handle and the process start instant.
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn install() -> Self
pub fn install() -> Self
Install the global Prometheus recorder and describe every metric. Call exactly once per process, before any metric is recorded.
§Panics
Panics if a global recorder is already installed.
Sourcepub fn for_test() -> Self
pub fn for_test() -> Self
Build a non-installing handle for tests.
The metrics! macros always target the globally installed
recorder, which this constructor never sets. The returned handle
therefore renders an empty snapshot regardless of any metric
recorded elsewhere. Use Self::install plus
super::ControlState::with_metrics to serve live metrics.
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnsafeUnpin for Metrics
impl UnwindSafe for Metrics
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request