nwangtw commented on a change in pull request #3293: Bug: Read override config 
in Metrics Manager
URL: https://github.com/apache/incubator-heron/pull/3293#discussion_r294524795
 
 

 ##########
 File path: 
heron/metricsmgr/src/java/org/apache/heron/metricsmgr/MetricsSinksConfig.java
 ##########
 @@ -42,21 +42,33 @@
   private final Map<String, Map<String, Object>> sinksConfigs = new 
HashMap<>();
 
   @SuppressWarnings("unchecked")
-  public MetricsSinksConfig(String filename) throws FileNotFoundException {
-    FileInputStream fin = new FileInputStream(new File(filename));
+  public MetricsSinksConfig(String metricsSinksConfigFilename, String 
overrideConfigFilename)
+      throws FileNotFoundException {
+    FileInputStream sinkConfigStream = new FileInputStream(new 
File(metricsSinksConfigFilename));
+    FileInputStream overrideStream = new FileInputStream(new 
File(overrideConfigFilename));
     try {
       Yaml yaml = new Yaml();
-      Map<Object, Object> ret = (Map<Object, Object>) yaml.load(fin);
+      Map<Object, Object> sinkConfig = (Map<Object, Object>) 
yaml.load(sinkConfigStream);
+      Map<Object, Object> overrideConfig = (Map<Object, Object>) 
yaml.load(overrideStream);
 
-      if (ret == null) {
+      if (sinkConfig == null) {
         throw new RuntimeException("Could not parse metrics-sinks config 
file");
-      } else {
-        for (String sinkId : 
TypeUtils.getListOfStrings(ret.get(CONFIG_KEY_METRICS_SINKS))) {
-          sinksConfigs.put(sinkId, (Map<String, Object>) ret.get(sinkId));
-        }
+      }
+
+      if (overrideConfig == null) {
+        throw new RuntimeException("Could not parse override config file");
 
 Review comment:
   Let's include the file name in the message.

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