File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ use crate::proto;
1515use cfg_if:: cfg_if;
1616use lazy_static:: lazy_static;
1717
18+ #[ derive( Default ) ]
1819struct RegistryCore {
1920 pub collectors_by_id : HashMap < u64 , Box < dyn Collector > > ,
2021 pub dim_hashes_by_name : HashMap < String , u64 > ,
@@ -216,31 +217,15 @@ impl RegistryCore {
216217
217218/// A struct for registering Prometheus collectors, collecting their metrics, and gathering
218219/// them into `MetricFamilies` for exposition.
219- #[ derive( Clone , Debug ) ]
220+ #[ derive( Clone , Default , Debug ) ]
220221pub struct Registry {
221222 r : Arc < RwLock < RegistryCore > > ,
222223}
223224
224- impl Default for Registry {
225- fn default ( ) -> Registry {
226- let r = RegistryCore {
227- collectors_by_id : HashMap :: new ( ) ,
228- dim_hashes_by_name : HashMap :: new ( ) ,
229- desc_ids : HashSet :: new ( ) ,
230- labels : None ,
231- prefix : None ,
232- } ;
233-
234- Registry {
235- r : Arc :: new ( RwLock :: new ( r) ) ,
236- }
237- }
238- }
239-
240225impl Registry {
241226 /// `new` creates a Registry.
242227 pub fn new ( ) -> Registry {
243- Registry :: default ( )
228+ Default :: default ( )
244229 }
245230
246231 /// Create a new registry, with optional custom prefix and labels.
You can’t perform that action at this time.
0 commit comments