You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2019/08/22 05:50:09 UTC

[helix] 09/10: Make the reservoir sliding window length used in Helix monintor metrics configurable. #382

This is an automated email from the ASF dual-hosted git repository.

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

commit 955e566eec7ea6dafed9d55d8dd2f9ba9b141efc
Author: chenboat <ch...@gmail.com>
AuthorDate: Tue Aug 20 21:21:03 2019 -0700

    Make the reservoir sliding window length used in Helix monintor metrics configurable. #382
---
 helix-core/src/main/java/org/apache/helix/SystemPropertyKeys.java    | 3 +++
 .../helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java  | 5 +++--
 .../java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/SystemPropertyKeys.java b/helix-core/src/main/java/org/apache/helix/SystemPropertyKeys.java
index 047d1e8..1a6a797 100644
--- a/helix-core/src/main/java/org/apache/helix/SystemPropertyKeys.java
+++ b/helix-core/src/main/java/org/apache/helix/SystemPropertyKeys.java
@@ -35,4 +35,7 @@ public class SystemPropertyKeys {
 
   // Controller
   public static final String CONTROLLER_MESSAGE_PURGE_DELAY = "helix.controller.stages.MessageGenerationPhase.messagePurgeDelay";
+
+  // MBean monitor for helix.
+  public static final String HELIX_MONITOR_TIME_WINDOW_LENGTH_MS = "helix.monitor.slidingTimeWindow.ms";
 }
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
index e45820e..b15a29e 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
@@ -40,6 +40,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.helix.SystemPropertyKeys;
 import org.apache.helix.monitoring.SensorNameProvider;
 import org.apache.helix.monitoring.mbeans.MBeanRegistrar;
 import org.apache.helix.util.HelixUtil;
@@ -231,7 +232,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
    * in the system env variables. If not found, use default value.
    */
   protected Long getResetIntervalInMs() {
-    return HelixUtil
-        .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS);
+    return HelixUtil.getSystemPropertyAsLong(SystemPropertyKeys.HELIX_MONITOR_TIME_WINDOW_LENGTH_MS,
+        DEFAULT_RESET_INTERVAL_MS);
   }
 }
diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java
index a38fb66..a1d31f0 100644
--- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java
+++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestZkClientMonitor.java
@@ -155,7 +155,7 @@ public class TestZkClientMonitor {
   @Test
   public void testCustomizedResetInterval() throws JMException, InterruptedException {
     // Use a customized reservoir sliding length of 1 ms.
-    System.setProperty("reservoir.length.ms", "1");
+    System.setProperty("helix.monitor.slidingTimeWindow.ms", "1");
     final String TEST_TAG = "test_tag_x";
     final String TEST_KEY = "test_key_x";
     final String TEST_INSTANCE = "test_instance_x";