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_r270365936
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java ########## @@ -170,12 +173,39 @@ public static MetricRegistryConfiguration fromConfiguration(Configuration config } } + List<ReporterSetup> reporterArguments = new ArrayList<>(reporterConfigurations.size()); + for (Tuple2<String, Configuration> reporterConfiguration: reporterConfigurations) { + String reporterName = reporterConfiguration.f0; + Configuration reporterConfig = reporterConfiguration.f1; + + try { + final String reporterClassName = reporterConfig.getString(ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, null); + if (reporterClassName == null) { + LOG.error("No reporter class set for reporter " + reporterName + ". Metrics might not be exposed/reported."); + continue; + } + + final SupplierWithException<MetricReporter, Exception> supplier = () -> { + Class<?> reporterClass = Class.forName(reporterClassName); + return (MetricReporter) reporterClass.newInstance(); + }; + + MetricConfig metricConfig = new MetricConfig(); + reporterConfig.addAllToProperties(metricConfig); Review comment: We could factor this logic out into a separate method e.g. `ReporterSetup#fromConfiguration()` or so. ---------------------------------------------------------------- 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