MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / register

Method register

nodedb-cluster/src/loop_metrics.rs:186–195  ·  view source on GitHub ↗
(&self, metrics: Arc<LoopMetrics>)

Source from the content-addressed store, hash-verified

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>> = {

Calls 4

lockMethod · 0.80
iterMethod · 0.45
nameMethod · 0.45
pushMethod · 0.45