Struct goodmetrics::metrics_factory::MetricsFactory
source · pub struct MetricsFactory<TMetricsAllocator, TSink> { /* private fields */ }
Implementations§
source§impl<TMetricsAllocator, TSink> MetricsFactory<TMetricsAllocator, TSink>
impl<TMetricsAllocator, TSink> MetricsFactory<TMetricsAllocator, TSink>
source§impl<TMetricsAllocator, TSink> MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: Default,
impl<TMetricsAllocator, TSink> MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: Default,
pub fn new(sink: TSink) -> Self
pub fn new_with_behaviors(sink: TSink, behaviors: &[MetricsBehavior]) -> Self
pub fn new_with_allocator(
sink: TSink,
behaviors: &[MetricsBehavior],
allocator: TMetricsAllocator
) -> Self
Trait Implementations§
source§impl<TMetricsAllocator, TSink> Clone for MetricsFactory<TMetricsAllocator, TSink>where
TSink: Clone,
TMetricsAllocator: Clone,
impl<TMetricsAllocator, TSink> Clone for MetricsFactory<TMetricsAllocator, TSink>where
TSink: Clone,
TMetricsAllocator: Clone,
Cloning a MetricsFactory is not cheap. You should cache it per-thread rather than doing so to work around visibility issues.
source§impl<TMetricsAllocator, TSink> Default for MetricsFactory<TMetricsAllocator, TSink>where
TSink: Default,
TMetricsAllocator: Default,
impl<TMetricsAllocator, TSink> Default for MetricsFactory<TMetricsAllocator, TSink>where
TSink: Default,
TMetricsAllocator: Default,
source§impl<'a, TMetricsRef, TMetricsAllocator, TSink> RecordingScope<'a, TMetricsRef> for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsRef: MetricsRef + 'a,
TSink: Sink<TMetricsRef>,
TMetricsAllocator: MetricsAllocator<'a, TMetricsRef> + Default,
impl<'a, TMetricsRef, TMetricsAllocator, TSink> RecordingScope<'a, TMetricsRef> for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsRef: MetricsRef + 'a,
TSink: Sink<TMetricsRef>,
TMetricsAllocator: MetricsAllocator<'a, TMetricsRef> + Default,
source§unsafe fn create_new_raw_metrics(
&'a self,
metrics_name: impl Into<Name>
) -> TMetricsRef
unsafe fn create_new_raw_metrics(
&'a self,
metrics_name: impl Into<Name>
) -> TMetricsRef
Safety
You should strongly consider using record_scope() instead. You must emit() the returned instance through this MetricsFactory instance or else you may leak memory, depending on the semantics of your allocator.
fn record_scope(
&'a self,
scope_name: impl Into<Name>
) -> ReturningRef<'a, TMetricsRef, Self>
fn record_scope_with_behavior(
&'a self,
scope_name: impl Into<Name>,
behavior: MetricsBehavior
) -> ReturningRef<'a, TMetricsRef, Self>
fn emit(&self, metrics: TMetricsRef)
source§impl<'a, TMetricsRef, TMetricsAllocator, TSink> ReturnTarget<'a, TMetricsRef> for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsRef: MetricsRef + 'a,
TMetricsAllocator: MetricsAllocator<'a, TMetricsRef> + Default,
TSink: Sink<TMetricsRef>,
impl<'a, TMetricsRef, TMetricsAllocator, TSink> ReturnTarget<'a, TMetricsRef> for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsRef: MetricsRef + 'a,
TMetricsAllocator: MetricsAllocator<'a, TMetricsRef> + Default,
TSink: Sink<TMetricsRef>,
fn return_referent(&self, to_return: TMetricsRef)
Auto Trait Implementations§
impl<TMetricsAllocator, TSink> RefUnwindSafe for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: RefUnwindSafe,
TSink: RefUnwindSafe,
impl<TMetricsAllocator, TSink> Send for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: Send,
TSink: Send,
impl<TMetricsAllocator, TSink> Sync for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: Sync,
TSink: Sync,
impl<TMetricsAllocator, TSink> Unpin for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: Unpin,
TSink: Unpin,
impl<TMetricsAllocator, TSink> UnwindSafe for MetricsFactory<TMetricsAllocator, TSink>where
TMetricsAllocator: UnwindSafe,
TSink: 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>
Wrap the input message
T
in a tonic::Request