shenh062326 commented on a change in pull request #1732:
URL: https://github.com/apache/hudi/pull/1732#discussion_r440626479



##########
File path: 
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/HoodieDeltaStreamerMetrics.java
##########
@@ -67,12 +73,41 @@ String getMetricsName(String action, String metric) {
 
   public void updateDeltaStreamerMetrics(long durationInNs, long hiveSyncNs) {
     if (config.isMetricsOn()) {
-      Metrics.registerGauge(getMetricsName("deltastreamer", "duration"), 
getDurationInMs(durationInNs));
-      Metrics.registerGauge(getMetricsName("deltastreamer", 
"hiveSyncDuration"), getDurationInMs(hiveSyncNs));
+      registerOrUpdateMetrics(getMetricsName("deltastreamer", "duration"), 
getDurationInMs(durationInNs));
+      registerOrUpdateMetrics(getMetricsName("deltastreamer", 
"hiveSyncDuration"), getDurationInMs(hiveSyncNs));
     }
   }
 
   public long getDurationInMs(long ctxDuration) {
     return ctxDuration / 1000000;
   }
+  
+  public void registerOrUpdateMetrics(String metricsName, Object value) {
+    if (metrics.containsKey(metricsName)) {
+      metrics.get(metricsName).set(value);

Review comment:
       Update value will be sent by MetricsGraphiteReporter, 
MetricsGraphiteReporter.start() will start GraphiteReporter and will report 
metric periodically. 




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


Reply via email to