tillrohrmann commented on a change in pull request #8002: 
[FLINK-11923][metrics] MetricRegistryConfiguration provides MetricReporters 
Suppliers
URL: https://github.com/apache/flink/pull/8002#discussion_r270397980
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java
 ##########
 @@ -144,11 +135,9 @@ public MetricRegistryImpl(MetricRegistryConfiguration 
config) {
                                                }
                                        }
 
-                                       Class<?> reporterClass = 
Class.forName(className);
-                                       MetricReporter reporterInstance = 
(MetricReporter) reporterClass.newInstance();
+                                       final MetricReporter reporterInstance = 
reporterSetup.getSupplier().get();
 
 Review comment:
   Can't this happen outside of the `MetricRegistryImpl` when we create the 
`MetricReporter` or is there a contract that certain operations can only be 
when we create the `MetricRegistryImpl`? If the `MetricReporter` depend on the 
`MetricRegistryImpl` then I understand why we need a factory. But if not, then 
I think it would be easier to directly start the `MetricReporters`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to