leesf commented on a change in pull request #1529: [HUDI-800] fix Metrics 
getReporter().close() throws NPE when MetricsR…
URL: https://github.com/apache/incubator-hudi/pull/1529#discussion_r410796460
 
 

 ##########
 File path: hudi-client/src/main/java/org/apache/hudi/metrics/Metrics.java
 ##########
 @@ -52,9 +52,11 @@ private Metrics(HoodieWriteConfig metricConfig) {
     Runtime.getRuntime().addShutdownHook(new Thread(() -> {
       try {
         reporter.report();
-        getReporter().close();
+        if (getReporter() != null) {
+          getReporter().close();
+        }
       } catch (Exception e) {
-        e.printStackTrace();
+        LOG.error("Error while closing reporter", e);
 
 Review comment:
   How about changing the error level to warn?

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