Struct glean_core::metrics::RateMetric [−][src]
A rate metric.
Used to determine the proportion of things via two counts:
- A numerator defining the amount of times something happened,
- A denominator counting the amount of times someting could have happened.
Both numerator and denominator can only be incremented, not decremented.
Implementations
impl RateMetric
[src]
pub fn new(meta: CommonMetricData) -> Self
[src]
Creates a new rate metric.
pub fn add_to_numerator(&self, glean: &Glean, amount: i32)
[src]
Increases the numerator by amount
.
Arguments
glean
- The Glean instance this metric belongs to.amount
- The amount to increase by. Should be non-negative.
Notes
Logs an error if the amount
is negative.
pub fn add_to_denominator(&self, glean: &Glean, amount: i32)
[src]
Increases the denominator by amount
.
Arguments
glean
- The Glean instance this metric belongs to.amount
- The amount to increase by. Should be non-negative.
Notes
Logs an error if the amount
is negative.
pub fn test_get_value(
&self,
glean: &Glean,
storage_name: &str
) -> Option<(i32, i32)>
[src]
&self,
glean: &Glean,
storage_name: &str
) -> Option<(i32, i32)>
Test-only API (exported for FFI purposes).
Gets the currently stored value as a pair of integers.
This doesn’t clear the stored value.
Trait Implementations
impl Clone for RateMetric
[src]
fn clone(&self) -> RateMetric
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RateMetric
[src]
impl MetricType for RateMetric
[src]
fn meta(&self) -> &CommonMetricData
[src]
fn meta_mut(&mut self) -> &mut CommonMetricData
[src]
fn should_record(&self, glean: &Glean) -> bool
[src]
Auto Trait Implementations
impl RefUnwindSafe for RateMetric
impl Send for RateMetric
impl Sync for RateMetric
impl Unpin for RateMetric
impl UnwindSafe for RateMetric
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,