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_r270365335
########## 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: I like the idea of not instantiating the `MetricReporters` directly in the `MetricRegistryImpl`. But do we actually need lazy instantiation our couldn't we simply pass in a `Collection<MetricReporter>` to the `MetricRegistryImpl`? I think this would further simplify the `MetricRegistryImpl`. ---------------------------------------------------------------- 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