Removes a gauge metric with the given name.
(&mut self, name: &str)
| 170 | |
| 171 | /// Removes a gauge metric with the given name. |
| 172 | pub fn remove_gauge(&mut self, name: &str) { |
| 173 | if let Some(gauge) = self.metric_gauges.remove(name) { |
| 174 | self.registry |
| 175 | .unregister(Box::new(gauge)) |
| 176 | .expect("Failed to unregister gauge"); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /// Exports the metrics in the registry to a buffer in text format. |
| 181 | pub fn export_metrics(&self) -> Result<Vec<u8>, prometheus::Error> { |