@@ -124,19 +124,38 @@ pub fn store_factory<'a>(
124124 store. clone ( ) . register_health ( health_registry_builder) ;
125125 }
126126
127- Ok ( Store :: new ( MetricsStore :: new ( Arc :: new ( Store :: new ( store) ) , name, compute_store_type ( backend) ) ) )
127+ let store = Store :: new ( store) ;
128+
129+ return if should_wrap_metrics_store ( backend) {
130+ Ok ( Store :: new ( MetricsStore :: new (
131+ Arc :: new ( store) ,
132+ name,
133+ compute_store_type ( backend) ,
134+ ) ) )
135+ } else {
136+ Ok ( store)
137+ }
128138 } )
129139}
130140
141+ fn should_wrap_metrics_store ( spec : & StoreSpec ) -> bool {
142+ matches ! (
143+ spec,
144+ StoreSpec :: Memory ( _)
145+ | StoreSpec :: ExperimentalCloudObjectStore ( _)
146+ | StoreSpec :: ExperimentalMongo ( _)
147+ | StoreSpec :: Filesystem ( _)
148+ | StoreSpec :: RedisStore ( _)
149+ )
150+ }
151+
131152fn compute_store_type ( spec : & StoreSpec ) -> StoreType {
132153 match spec {
133154 StoreSpec :: Memory ( _) => StoreType :: Memory ,
134- StoreSpec :: ExperimentalCloudObjectStore ( s) => {
135- match s {
136- ExperimentalCloudObjectSpec :: Aws ( _) => StoreType :: S3 ,
137- ExperimentalCloudObjectSpec :: Gcs ( _) => StoreType :: Gcs ,
138- ExperimentalCloudObjectSpec :: Ontap ( _) => StoreType :: OntapS3 ,
139- }
155+ StoreSpec :: ExperimentalCloudObjectStore ( s) => match s {
156+ ExperimentalCloudObjectSpec :: Aws ( _) => StoreType :: S3 ,
157+ ExperimentalCloudObjectSpec :: Gcs ( _) => StoreType :: Gcs ,
158+ ExperimentalCloudObjectSpec :: Ontap ( _) => StoreType :: OntapS3 ,
140159 } ,
141160 StoreSpec :: RedisStore ( _) => StoreType :: Redis ,
142161 StoreSpec :: Verify ( _) => StoreType :: Verify ,
@@ -151,10 +170,10 @@ fn compute_store_type(spec: &StoreSpec) -> StoreType {
151170 StoreSpec :: Grpc ( _) => StoreType :: Grpc ,
152171 StoreSpec :: Noop ( _) => StoreType :: Noop ,
153172 StoreSpec :: ExperimentalMongo ( _) => StoreType :: Mongo ,
154- StoreSpec :: Shard ( _) => StoreType :: Metrics ,
173+ StoreSpec :: RefStore ( _) => StoreType :: Ref ,
174+ StoreSpec :: Shard ( _) => StoreType :: Shard ,
155175 _ => {
156176 panic ! ( "Invalid store spec: {:?}" , spec) ;
157177 }
158178 }
159179}
160-
0 commit comments