timsants commented on a change in pull request #7551:
URL: https://github.com/apache/pinot/pull/7551#discussion_r727532941



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
##########
@@ -70,21 +74,31 @@ public static void init(PinotConfiguration 
metricsConfiguration) {
   private static void initializePinotMetricsFactory(PinotConfiguration 
metricsConfiguration) {
     Set<Class<?>> classes = getPinotMetricsFactoryClasses();
     if (classes.size() > 1) {
-      LOGGER.warn("More than one PinotMetricsFactory is initialized: {}", 
classes);
+      LOGGER.warn("More than one PinotMetricsFactory was found: {}", classes);
     }
-    for (Class<?> clazz : classes) {
-      MetricsFactory annotation = clazz.getAnnotation(MetricsFactory.class);
-      LOGGER.info("Trying to init PinotMetricsFactory: {} and MetricsFactory: 
{}", clazz, annotation);
-      if (annotation.enabled()) {
-        try {
-          PinotMetricsFactory pinotMetricsFactory = (PinotMetricsFactory) 
clazz.newInstance();
-          pinotMetricsFactory.init(metricsConfiguration);
-          registerMetricsFactory(pinotMetricsFactory);
-        } catch (Exception e) {
-          LOGGER.error("Caught exception while initializing pinot metrics 
registry: {}, skipping it", clazz, e);
+
+    String metricsFactoryClassName = 
metricsConfiguration.getProperty(CONFIG_OF_METRICS_FACTORY_CLASS_NAME,
+        DEFAULT_METRICS_FACTORY_CLASS_NAME);
+    LOGGER.info("{} will be initialized as the PinotMetricsFactory", 
metricsFactoryClassName);
+
+    Optional<Class<?>> maybeClazz = classes.stream().filter(c -> 
c.getName().equals(metricsFactoryClassName))

Review comment:
       Changing to `clazzFound`.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to