helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [helix] branch master updated: Add totalMessageReceivedCounter and decrepcate old totalMessageReceived (#1251)
Date Wed, 12 Aug 2020 18:01:45 GMT
This is an automated email from the ASF dual-hosted git repository.

jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new f737b83  Add totalMessageReceivedCounter and decrepcate old totalMessageReceived
(#1251)
f737b83 is described below

commit f737b83245594e80c2d28b0c3da3b00bec50fd99
Author: Junkai Xue <jxue@linkedin.com>
AuthorDate: Wed Aug 12 11:01:39 2020 -0700

    Add totalMessageReceivedCounter and decrepcate old totalMessageReceived (#1251)
    
    Currently we should have counter type for totalMessageReceived but did not make it correct.
    To fix this, we should have the a new counter metrics instead of directly changing the
metrics for smooth migration.
---
 .../apache/helix/monitoring/mbeans/ClusterStatusMonitor.java |  1 +
 .../org/apache/helix/monitoring/mbeans/ResourceMonitor.java  | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java
index 1911385..da49041 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterStatusMonitor.java
@@ -390,6 +390,7 @@ public class ClusterStatusMonitor implements ClusterStatusMonitorMBean
{
       ResourceMonitor resourceMonitor = _resourceMonitorMap.get(resource);
       if (resourceMonitor != null) {
         resourceMonitor.increaseMessageCount(messageCountPerResource.get(resource));
+        resourceMonitor.increaseMessageCountWithCounter(messageCountPerResource.get(resource));
       }
     }
   }
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
index 111a652..b659f9c 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
@@ -71,8 +71,9 @@ public class ResourceMonitor extends DynamicMBeanProvider {
   private SimpleDynamicMetric<Long> _successTopStateHandoffCounter;
   private SimpleDynamicMetric<Long> _failedTopStateHandoffCounter;
   private SimpleDynamicMetric<Long> _maxSinglePartitionTopStateHandoffDuration;
-  private SimpleDynamicMetric<Long> _totalMessageReceived;
-
+  @Deprecated
+  private SimpleDynamicMetric<Long> _totalMessageReceived; // This should be counter
since the value behavior is ever-increasing
+  private SimpleDynamicMetric<Long> _totalMessageReceivedCounter;
   // Histograms
   private HistogramDynamicMetric _partitionTopStateHandoffDurationGauge;
   private HistogramDynamicMetric _partitionTopStateHandoffHelixLatencyGauge;
@@ -138,6 +139,7 @@ public class ResourceMonitor extends DynamicMBeanProvider {
             new SlidingTimeWindowArrayReservoir(getResetIntervalInMs(), TimeUnit.MILLISECONDS)));
 
     _totalMessageReceived = new SimpleDynamicMetric("TotalMessageReceived", 0L);
+    _totalMessageReceivedCounter = new SimpleDynamicMetric("TotalMessageReceivedCounter",
0L);
     _maxSinglePartitionTopStateHandoffDuration =
         new SimpleDynamicMetric("MaxSinglePartitionTopStateHandoffDurationGauge", 0L);
     _failedTopStateHandoffCounter = new SimpleDynamicMetric("FailedTopStateHandoffCounter",
0L);
@@ -202,10 +204,15 @@ public class ResourceMonitor extends DynamicMBeanProvider {
     return _totalMessageReceived.getValue();
   }
 
+  @Deprecated
   public synchronized void increaseMessageCount(long messageReceived) {
     _totalMessageReceived.updateValue(_totalMessageReceived.getValue() + messageReceived);
   }
 
+  public synchronized void increaseMessageCountWithCounter(long messageReceived) {
+    _totalMessageReceivedCounter.updateValue(_totalMessageReceivedCounter.getValue() + messageReceived);
+  }
+
   public String getResourceName() {
     return _resourceName;
   }
@@ -467,6 +474,7 @@ public class ResourceMonitor extends DynamicMBeanProvider {
         _partitionTopStateHandoffHelixLatencyGauge,
         _partitionTopStateNonGracefulHandoffDurationGauge,
         _totalMessageReceived,
+        _totalMessageReceivedCounter,
         _numPendingStateTransitions,
         _rebalanceState
     );


Mime
View raw message