keith-turner commented on code in PR #5021:
URL: https://github.com/apache/accumulo/pull/5021#discussion_r1821493309


##########
server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java:
##########
@@ -251,23 +206,42 @@ public DistributionStatisticConfig configure(Meter.Id id,
       String userRegistryFactories =
           context.getConfiguration().get(Property.GENERAL_MICROMETER_FACTORY);
 
+      List<MeterRegistry> registries = new ArrayList<>();
+
       for (String factoryName : getTrimmedStrings(userRegistryFactories)) {
         try {
           MeterRegistry registry = getRegistryFromFactory(factoryName, 
context);
           registry.config().commonTags(commonTags.values());
           registry.config().meterFilter(replicationFilter);
-          addRegistry(registry);
+          registries.add(registry);
         } catch (ReflectiveOperationException ex) {
           LOG.warn("Could not load registry {}", factoryName, ex);
         }
       }
 
-      pendingRegistries.forEach(registry -> composite.add(registry));
+      if (registries.size() == 1) {
+        meterRegistry = registries.get(0);
+      } else {
+        var composite = new CompositeMeterRegistry();
+        composite.config().commonTags(commonTags.values());
+        registries.forEach(composite::add);
+        meterRegistry = composite;

Review Comment:
   > I don't think we need to create the second level CompositeMeterRegistry, I 
think we can just call MeterRegistry.add for each user supplied MeterRegistry. 
   
   Made that update in 0f70a87aef5b383c4c564c7462e6298e615044eb.  That change 
removes the double CompositeMeterRegistry. Also noticed there was functionality 
around common tags that was never used so removed that functionality in 
0f70a87aef5b383c4c564c7462e6298e615044eb to simplify the code further.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to