Trait glean_core::metrics::MetricType

source ·
pub trait MetricType {
    // Required method
    fn meta(&self) -> &CommonMetricDataInternal;

    // Provided methods
    fn with_name(&self, _name: String) -> Self
       where Self: Sized { ... }
    fn with_dynamic_label(&self, _label: String) -> Self
       where Self: Sized { ... }
    fn should_record(&self, glean: &Glean) -> bool { ... }
}
Expand description

A MetricType describes common behavior across all metrics.

Required Methods§

source

fn meta(&self) -> &CommonMetricDataInternal

Access the stored metadata

Provided Methods§

source

fn with_name(&self, _name: String) -> Self
where Self: Sized,

Create a new metric from this with a new name.

source

fn with_dynamic_label(&self, _label: String) -> Self
where Self: Sized,

Create a new metric from this with a specific label.

source

fn should_record(&self, glean: &Glean) -> bool

Whether this metric should currently be recorded

This depends on the metrics own state, as determined by its metadata, and whether upload is enabled on the Glean object.

Implementors§