Returns a gauge metric with the given name and helper message that explains what the gauge is measuring or tracking.
(&mut self, name: &str, helper_message: &str)
| 152 | /// Returns a gauge metric with the given name and helper message that explains what |
| 153 | /// the gauge is measuring or tracking. |
| 154 | pub fn gauge_mut(&mut self, name: &str, helper_message: &str) -> &mut Gauge { |
| 155 | match self.metric_gauges.entry(name.to_string()) { |
| 156 | Entry::Occupied(entry) => entry.into_mut(), |
| 157 | Entry::Vacant(entry) => { |
| 158 | let gauge = Gauge::with_opts(Opts::new( |
| 159 | format!("{}_{}", self.service_name, name), |
| 160 | helper_message, |
| 161 | )) |
| 162 | .unwrap(); |
| 163 | |
| 164 | self.registry.register(Box::new(gauge.clone())).unwrap(); |
| 165 | |
| 166 | entry.insert(gauge) |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | /// Removes a gauge metric with the given name. |
| 172 | pub fn remove_gauge(&mut self, name: &str) { |