pub trait Metrics: Send + Sync + DynClone + Debug {
    // Required methods
    fn create_counter(
        &self,
        name: String,
        unit_label: Option<String>
    ) -> Box<dyn Counter>;
    fn create_gauge(
        &self,
        name: String,
        unit_label: Option<String>
    ) -> Box<dyn Gauge>;
    fn create_histogram(
        &self,
        name: String,
        unit_label: Option<String>
    ) -> Box<dyn Histogram>;
    fn create_text(&self, name: String);
    fn counter_family(
        &self,
        name: String,
        labels: Vec<String>
    ) -> Box<dyn CounterFamily>;
    fn gauge_family(
        &self,
        name: String,
        labels: Vec<String>
    ) -> Box<dyn GaugeFamily>;
    fn histogram_family(
        &self,
        name: String,
        labels: Vec<String>
    ) -> Box<dyn HistogramFamily>;
    fn text_family(
        &self,
        name: String,
        labels: Vec<String>
    ) -> Box<dyn TextFamily>;
    fn subgroup(&self, subgroup_name: String) -> Box<dyn Metrics>;
}
Expand description

The metrics type.

Required Methods§

source

fn create_counter( &self, name: String, unit_label: Option<String> ) -> Box<dyn Counter>

Create a Counter with an optional unit_label.

The unit_label can be used to indicate what the unit of the value is, e.g. “kb” or “seconds”

source

fn create_gauge( &self, name: String, unit_label: Option<String> ) -> Box<dyn Gauge>

Create a Gauge with an optional unit_label.

The unit_label can be used to indicate what the unit of the value is, e.g. “kb” or “seconds”

source

fn create_histogram( &self, name: String, unit_label: Option<String> ) -> Box<dyn Histogram>

Create a Histogram with an optional unit_label.

The unit_label can be used to indicate what the unit of the value is, e.g. “kb” or “seconds”

source

fn create_text(&self, name: String)

Create a text metric.

Unlike other metrics, a textmetric does not have a value. It exists only to record a text string in the collected metrics, and possibly to care other key-value pairs as part of a TextFamily. Thus, the act of creating the text itself is sufficient to populate the text in the collect metrics; no setter function needs to be called.

source

fn counter_family( &self, name: String, labels: Vec<String> ) -> Box<dyn CounterFamily>

Create a family of related counters, partitioned by their label values.

source

fn gauge_family( &self, name: String, labels: Vec<String> ) -> Box<dyn GaugeFamily>

Create a family of related gauges, partitioned by their label values.

source

fn histogram_family( &self, name: String, labels: Vec<String> ) -> Box<dyn HistogramFamily>

Create a family of related histograms, partitioned by their label values.

source

fn text_family(&self, name: String, labels: Vec<String>) -> Box<dyn TextFamily>

Create a family of related text metricx, partitioned by their label values.

source

fn subgroup(&self, subgroup_name: String) -> Box<dyn Metrics>

Create a subgroup with a specified prefix.

Implementors§