Struct glean_core::metrics::RateMetric[][src]

pub struct RateMetric { /* fields omitted */ }

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]

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]

impl Debug for RateMetric[src]

impl MetricType for RateMetric[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.