Returns a gauge vec metric with the given name, helper message, and set of label names. The label names are used to partition the gauge metric into multiple dimensions.
(
&mut self,
name: &str,
helper_message: &str,
label_names: &[&str],
)
| 119 | /// |
| 120 | /// The label names are used to partition the gauge metric into multiple dimensions. |
| 121 | pub fn gauge_vec_mut( |
| 122 | &mut self, |
| 123 | name: &str, |
| 124 | helper_message: &str, |
| 125 | label_names: &[&str], |
| 126 | ) -> &mut GaugeVec { |
| 127 | match self.metric_gauge_vecs.entry(name.to_string()) { |
| 128 | Entry::Occupied(entry) => entry.into_mut(), |
| 129 | Entry::Vacant(entry) => { |
| 130 | let gauge = GaugeVec::new( |
| 131 | Opts::new(format!("{}_{}", self.service_name, name), helper_message), |
| 132 | label_names, |
| 133 | ) |
| 134 | .unwrap(); |
| 135 | |
| 136 | self.registry.register(Box::new(gauge.clone())).unwrap(); |
| 137 | |
| 138 | entry.insert(gauge) |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /// Removes a counter vec metric with the given name. |
| 144 | pub fn remove_gauge_vec(&mut self, name: &str) { |