Skip to main content

EventMetric

Struct EventMetric 

Source
pub struct EventMetric<K> { /* private fields */ }
Expand description

Developer-facing API for recording event metrics.

Instances of this class type are automatically generated by the parsers at build time, allowing developers to record values that were previously registered in the metrics.yaml file.

Implementations§

Source§

impl<K: ExtraKeys> EventMetric<K>

Source

pub fn new(meta: CommonMetricData) -> Self

The public constructor used by automatically generated metrics.

Source

pub fn record<M: Into<Option<K>>>(&self, extra: M)

Records an event.

§Arguments
  • extra - (optional) An object for the extra keys.
Source

pub fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32

Exported for test purposes.

Gets the number of recorded errors for the given metric and error type.

§Arguments
  • error - The type of error
§Returns

The number of errors reported.

Auto Trait Implementations§

§

impl<K> Forget for EventMetric<K>

§

impl<K> Freeze for EventMetric<K>
where PhantomData<K>: Freeze,

§

impl<K> Move for EventMetric<K>

§

impl<K> RefUnwindSafe for EventMetric<K>

§

impl<K> Send for EventMetric<K>
where PhantomData<K>: Send,

§

impl<K> Sync for EventMetric<K>
where PhantomData<K>: Sync,

§

impl<K> Unpin for EventMetric<K>
where PhantomData<K>: Unpin,

§

impl<K> UnsafeUnpin for EventMetric<K>

§

impl<K> UnwindSafe for EventMetric<K>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self> ⓘ

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.