Struct goodmetrics::metrics::Metrics
source · pub struct Metrics<TBuildHasher = RandomState> { /* private fields */ }
Implementations§
source§impl<TBuildHasher> Metrics<TBuildHasher>where
TBuildHasher: BuildHasher,
impl<TBuildHasher> Metrics<TBuildHasher>where
TBuildHasher: BuildHasher,
pub fn dimension(&self, name: impl Into<Name>, value: impl Into<Dimension>)
pub fn measurement(&self, name: impl Into<Name>, value: impl Into<Observation>)
pub fn distribution(&self, name: impl Into<Name>, value: impl Into<Distribution>)
pub fn time(&self, timer_name: impl Into<Name>) -> Timer<'_, TBuildHasher>
pub fn name(&self) -> &Name
pub fn restart(&mut self)
pub fn has_behavior(&self, behavior: MetricsBehavior) -> bool
sourcepub unsafe fn add_behavior(&mut self, behavior: MetricsBehavior)
pub unsafe fn add_behavior(&mut self, behavior: MetricsBehavior)
Safety
This function is intended to be used by MetricsFactories while creating new instances. It is not intended for use outside of infrastructure code. It is exposed in case you have something special you need to do with your allocator. You shouldn’t call this unless you know you need to and provide your own guarantees about when the behavior is added and whether it’s legal & valid
sourcepub unsafe fn set_raw_behavior(&mut self, behavior: u32)
pub unsafe fn set_raw_behavior(&mut self, behavior: u32)
Safety
This function is intended to be used by MetricsFactories while creating new instances. It is not intended for use outside of infrastructure code. It is exposed in case you have something special you need to do with your allocator. You shouldn’t call this unless you know you need to and provide your own guarantees about when the behavior is added and whether it’s legal & valid
sourcepub fn new(
name: impl Into<Name>,
start_time: Instant,
dimensions: HashMap<Name, Dimension, TBuildHasher>,
measurements: HashMap<Name, Measurement, TBuildHasher>,
behaviors: u32
) -> Self
pub fn new(
name: impl Into<Name>,
start_time: Instant,
dimensions: HashMap<Name, Dimension, TBuildHasher>,
measurements: HashMap<Name, Measurement, TBuildHasher>,
behaviors: u32
) -> Self
You should be getting Metrics instances from a MetricsFactory, which will be set up to send your recordings to wherever they’re supposed to go.
pub fn drain(
&mut self
) -> (Drain<'_, Name, Dimension>, Drain<'_, Name, Measurement>)
Trait Implementations§
Auto Trait Implementations§
impl<TBuildHasher = RandomState> !RefUnwindSafe for Metrics<TBuildHasher>
impl<TBuildHasher> Send for Metrics<TBuildHasher>where
TBuildHasher: Send,
impl<TBuildHasher = RandomState> !Sync for Metrics<TBuildHasher>
impl<TBuildHasher> Unpin for Metrics<TBuildHasher>where
TBuildHasher: Unpin,
impl<TBuildHasher> UnwindSafe for Metrics<TBuildHasher>where
TBuildHasher: UnwindSafe,
Blanket Implementations§
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>
T
in a tonic::Request