File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -582,18 +582,17 @@ impl WorkerMetricsPublisher {
582582
583583 /// Register KvStats Prometheus metrics with the component's registry
584584 pub fn register_prometheus_metrics ( & self , component : & Component ) -> Result < ( ) > {
585- // Create new KvStatsPrometheusGauges with registered metrics
586- let new_gauges = Arc :: new ( KvStatsPrometheusGauges :: new ( component) ?) ;
587-
588- // Use write lock only for initialization (happens once)
589- if let Ok ( mut gauges) = self . prometheus_gauges . write ( ) {
590- * gauges = Some ( new_gauges) ;
591- Ok ( ( ) )
592- } else {
593- Err ( anyhow:: anyhow!(
594- "Failed to acquire write lock on prometheus_gauges"
595- ) )
585+ let mut gauges = self
586+ . prometheus_gauges
587+ . write ( )
588+ . map_err ( |_| anyhow:: anyhow!( "Failed to acquire write lock on prometheus_gauges" ) ) ?;
589+
590+ // Only initialize if not already done
591+ if gauges. is_none ( ) {
592+ * gauges = Some ( Arc :: new ( KvStatsPrometheusGauges :: new ( component) ?) ) ;
596593 }
594+
595+ Ok ( ( ) )
597596 }
598597
599598 pub async fn create_endpoint (
You can’t perform that action at this time.
0 commit comments