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

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java
 ##########
 @@ -113,19 +114,12 @@ public MetricRegistryImpl(MetricRegistryConfiguration 
config) {
                        // by default, don't report anything
                        LOG.info("No metrics reporter configured, no metrics 
will be exposed/reported.");
                } else {
-                       // we have some reporters so
-                       for (Tuple2<String, Configuration> 
reporterConfiguration: reporterConfigurations) {
-                               String namedReporter = reporterConfiguration.f0;
-                               Configuration reporterConfig = 
reporterConfiguration.f1;
-
-                               final String className = 
reporterConfig.getString(ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, null);
-                               if (className == null) {
-                                       LOG.error("No reporter class set for 
reporter " + namedReporter + ". Metrics might not be exposed/reported.");
-                                       continue;
-                               }
+                       for (ReporterSetup reporterSetup : 
reporterConfigurations) {
+                               final String namedReporter = 
reporterSetup.getName();
+                               final MetricConfig metricConfig = 
reporterSetup.getConfiguration();
 
                                try {
-                                       String configuredPeriod = 
reporterConfig.getString(ConfigConstants.METRICS_REPORTER_INTERVAL_SUFFIX, 
null);
+                                       String configuredPeriod = 
metricConfig.getString(ConfigConstants.METRICS_REPORTER_INTERVAL_SUFFIX, null);
 
 Review comment:
   I may be biased here, but I don't believe we're hiding anything. 
`MetricConfig` is just a minor extension of `Properties` (which in hindsight 
shouldn't even exist) and I have no plans to change that. So long as that is 
the case there's no other place the value could come from but the configuration.
   
   As a more relatable example, would you say that 
`Configuration#getJobManagerHost()` hides in any way that the value is read 
from the configuration?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to