(&self, metrics: Arc<LoopMetrics>)
| 184 | } |
| 185 | |
| 186 | pub fn register(&self, metrics: Arc<LoopMetrics>) { |
| 187 | let mut g = self.loops.lock().unwrap_or_else(|p| p.into_inner()); |
| 188 | // Idempotent: a driver that respawns shouldn't duplicate its |
| 189 | // entry. Match on the interned name — there is exactly one |
| 190 | // `LoopMetrics` per loop in a process. |
| 191 | if g.iter().any(|m| m.name() == metrics.name()) { |
| 192 | return; |
| 193 | } |
| 194 | g.push(metrics); |
| 195 | } |
| 196 | |
| 197 | pub fn render_prom(&self, out: &mut String) { |
| 198 | let loops: Vec<Arc<LoopMetrics>> = { |