@@ -43,50 +43,38 @@ pub struct ShardMetrics {
4343impl ShardMetrics {
4444 /// Create and register metrics with the given context.
4545 pub fn new ( context : & impl MetricsTrait ) -> Self {
46- let erasure_decode_duration = Histogram :: new ( Buckets :: LOCAL ) ;
47- let reconstructed_blocks_cache_count = Gauge :: default ( ) ;
48- let reconstruction_states_count = Gauge :: default ( ) ;
49- let shards_received = Family :: < Peer , Counter > :: default ( ) ;
50- let blocks_reconstructed_total = Counter :: default ( ) ;
51- let reconstruction_failures_total = Counter :: default ( ) ;
52- context. register (
46+ let erasure_decode_duration = context. register (
5347 "erasure_decode_duration" ,
5448 "Histogram of erasure decoding duration in seconds" ,
55- erasure_decode_duration . clone ( ) ,
49+ Histogram :: new ( Buckets :: LOCAL ) ,
5650 ) ;
57- context. register (
58- "reconstructed_blocks_cache_count" ,
59- "Number of blocks in the reconstructed blocks cache" ,
60- reconstructed_blocks_cache_count. clone ( ) ,
61- ) ;
62- context. register (
63- "reconstruction_states_count" ,
64- "Number of active reconstruction states" ,
65- reconstruction_states_count. clone ( ) ,
66- ) ;
67- context. register (
68- "shards_received" ,
69- "Number of shards received per peer" ,
70- shards_received. clone ( ) ,
71- ) ;
72- context. register (
73- "blocks_reconstructed_total" ,
74- "Total number of blocks successfully reconstructed" ,
75- blocks_reconstructed_total. clone ( ) ,
76- ) ;
77- context. register (
78- "reconstruction_failures_total" ,
79- "Total number of block reconstruction failures" ,
80- reconstruction_failures_total. clone ( ) ,
81- ) ;
82-
8351 Self {
8452 erasure_decode_duration : histogram:: Timed :: new ( erasure_decode_duration) ,
85- reconstructed_blocks_cache_count,
86- reconstruction_states_count,
87- shards_received,
88- blocks_reconstructed_total,
89- reconstruction_failures_total,
53+ reconstructed_blocks_cache_count : context. register (
54+ "reconstructed_blocks_cache_count" ,
55+ "Number of blocks in the reconstructed blocks cache" ,
56+ Gauge :: default ( ) ,
57+ ) ,
58+ reconstruction_states_count : context. register (
59+ "reconstruction_states_count" ,
60+ "Number of active reconstruction states" ,
61+ Gauge :: default ( ) ,
62+ ) ,
63+ shards_received : context. register (
64+ "shards_received" ,
65+ "Number of shards received per peer" ,
66+ Family :: < Peer , Counter > :: default ( ) ,
67+ ) ,
68+ blocks_reconstructed_total : context. register (
69+ "blocks_reconstructed_total" ,
70+ "Total number of blocks successfully reconstructed" ,
71+ Counter :: default ( ) ,
72+ ) ,
73+ reconstruction_failures_total : context. register (
74+ "reconstruction_failures_total" ,
75+ "Total number of block reconstruction failures" ,
76+ Counter :: default ( ) ,
77+ ) ,
9078 }
9179 }
9280}
0 commit comments