Trait hotshot_types::traits::metrics::Metrics
source · 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§
sourcefn create_counter(
&self,
name: String,
unit_label: Option<String>,
) -> Box<dyn Counter>
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”
sourcefn create_gauge(
&self,
name: String,
unit_label: Option<String>,
) -> Box<dyn Gauge>
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”
sourcefn create_histogram(
&self,
name: String,
unit_label: Option<String>,
) -> Box<dyn Histogram>
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”
sourcefn create_text(&self, name: String)
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.
sourcefn counter_family(
&self,
name: String,
labels: Vec<String>,
) -> Box<dyn CounterFamily>
fn counter_family( &self, name: String, labels: Vec<String>, ) -> Box<dyn CounterFamily>
Create a family of related counters, partitioned by their label values.
sourcefn gauge_family(
&self,
name: String,
labels: Vec<String>,
) -> Box<dyn GaugeFamily>
fn gauge_family( &self, name: String, labels: Vec<String>, ) -> Box<dyn GaugeFamily>
Create a family of related gauges, partitioned by their label values.
sourcefn histogram_family(
&self,
name: String,
labels: Vec<String>,
) -> Box<dyn HistogramFamily>
fn histogram_family( &self, name: String, labels: Vec<String>, ) -> Box<dyn HistogramFamily>
Create a family of related histograms, partitioned by their label values.
sourcefn text_family(&self, name: String, labels: Vec<String>) -> Box<dyn TextFamily>
fn text_family(&self, name: String, labels: Vec<String>) -> Box<dyn TextFamily>
Create a family of related text metricx, partitioned by their label values.