Struct glean::private::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
sourceimpl<K: ExtraKeys> EventMetric<K>
impl<K: ExtraKeys> EventMetric<K>
sourcepub fn new(meta: CommonMetricData) -> Self
pub fn new(meta: CommonMetricData) -> Self
The public constructor used by automatically generated metrics.
sourcepub fn record_with_time(&self, timestamp: u64, extra: HashMap<String, String>)
pub fn record_with_time(&self, timestamp: u64, extra: HashMap<String, String>)
Record a new event with a provided timestamp.
It’s the caller’s responsibility to ensure the timestamp comes from the same clock source.
Use glean::get_timestamp_ms
to get a valid timestamp.
sourceimpl<K: ExtraKeys> EventMetric<K>
impl<K: ExtraKeys> EventMetric<K>
sourcepub fn test_get_value<'a, S: Into<Option<&'a str>>>(
&self,
ping_name: S
) -> Option<Vec<RecordedEvent>>
pub fn test_get_value<'a, S: Into<Option<&'a str>>>(
&self,
ping_name: S
) -> Option<Vec<RecordedEvent>>
Trait Implementations
sourceimpl<K: Clone> Clone for EventMetric<K>
impl<K: Clone> Clone for EventMetric<K>
sourcefn clone(&self) -> EventMetric<K>
fn clone(&self) -> EventMetric<K>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<K: ExtraKeys> Event for EventMetric<K>
impl<K: ExtraKeys> Event for EventMetric<K>
type Extra = K
type Extra = K
The type of the allowed extra keys for this event.
sourcefn record<M: Into<Option<<Self as Event>::Extra>>>(&self, extra: M)
fn record<M: Into<Option<<Self as Event>::Extra>>>(&self, extra: M)
Records an event. Read more
sourcefn test_get_value<'a, S: Into<Option<&'a str>>>(
&self,
ping_name: S
) -> Option<Vec<RecordedEvent>>
fn test_get_value<'a, S: Into<Option<&'a str>>>(
&self,
ping_name: S
) -> Option<Vec<RecordedEvent>>
Exported for test purposes. Read more
Auto Trait Implementations
impl<K> RefUnwindSafe for EventMetric<K> where
K: RefUnwindSafe,
impl<K> Send for EventMetric<K> where
K: Send,
impl<K> Sync for EventMetric<K> where
K: Sync,
impl<K> Unpin for EventMetric<K> where
K: Unpin,
impl<K> UnwindSafe for EventMetric<K> where
K: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more