1pub trait MetricEmitter {
12 fn record_counter(&mut self, instrument: &'static str, value: u64, unit: Option<&'static str>);
14 fn record_gauge_u64(
16 &mut self,
17 instrument: &'static str,
18 value: u64,
19 unit: Option<&'static str>,
20 );
21 fn record_gauge_f64(
23 &mut self,
24 instrument: &'static str,
25 value: f64,
26 unit: Option<&'static str>,
27 );
28 fn record_histogram(
30 &mut self,
31 instrument: &'static str,
32 value: f64,
33 unit: Option<&'static str>,
34 bounds: &'static [f64],
35 );
36 fn with_attributes(&mut self, attrs: &[(&'static str, &str)]);
38}
39
40#[derive(Debug, Default, Clone, Copy)]
43pub struct NoopMetricEmitter;
44
45impl MetricEmitter for NoopMetricEmitter {
46 fn record_counter(&mut self, _: &'static str, _: u64, _: Option<&'static str>) {}
47 fn record_gauge_u64(&mut self, _: &'static str, _: u64, _: Option<&'static str>) {}
48 fn record_gauge_f64(&mut self, _: &'static str, _: f64, _: Option<&'static str>) {}
49 fn record_histogram(
50 &mut self,
51 _: &'static str,
52 _: f64,
53 _: Option<&'static str>,
54 _: &'static [f64],
55 ) {
56 }
57 fn with_attributes(&mut self, _: &[(&'static str, &str)]) {}
58}