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 9434cf112e224b68dbfddc04f4ca5eafd0ce6298 Author: chenboat <[email protected]> AuthorDate: Fri Aug 9 00:06:11 2019 -0700 Use the system property value as the sliding window length. #382 --- .../monitoring/mbeans/ClusterEventMonitor.java | 5 ++++- .../monitoring/mbeans/HelixCallbackMonitor.java | 5 ++++- .../apache/helix/monitoring/mbeans/JobMonitor.java | 26 +++++++++++++--------- .../monitoring/mbeans/MessageLatencyMonitor.java | 5 ++++- .../helix/monitoring/mbeans/ResourceMonitor.java | 13 ++++++++--- .../mbeans/RoutingTableProviderMonitor.java | 11 ++++++--- .../mbeans/StateTransitionStatMonitor.java | 15 ++++++++----- .../monitoring/mbeans/ZkClientPathMonitor.java | 25 +++++++++++++-------- .../mbeans/dynamicMBeans/DynamicMBeanProvider.java | 1 + 9 files changed, 73 insertions(+), 33 deletions(-) diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java index 25b7894..06c29a8 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ClusterEventMonitor.java @@ -26,6 +26,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; import javax.management.JMException; import java.util.ArrayList; @@ -57,7 +58,9 @@ public class ClusterEventMonitor extends DynamicMBeanProvider { _clusterStatusMonitor = clusterStatusMonitor; _duration = new HistogramDynamicMetric("DurationGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _count = new SimpleDynamicMetric("EventCounter", 0l); _maxDuration = new SimpleDynamicMetric("MaxSingleDurationGauge", 0l); _totalDuration = new SimpleDynamicMetric("TotalDurationCounter", 0l); diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java index 4c595da..f469609 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/HelixCallbackMonitor.java @@ -27,6 +27,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; import javax.management.JMException; import java.util.ArrayList; @@ -64,7 +65,9 @@ public class HelixCallbackMonitor extends DynamicMBeanProvider { changeType.name()); _latencyGauge = new HistogramDynamicMetric("LatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _totalLatencyCounter = new SimpleDynamicMetric("LatencyCounter", 0l); _unbatchedCounter = new SimpleDynamicMetric("UnbatchedCounter", 0l); _counter = new SimpleDynamicMetric("Counter", 0l); diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/JobMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/JobMonitor.java index 0c4aad4..68ebcd5 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/JobMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/JobMonitor.java @@ -31,6 +31,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; import org.apache.helix.task.TaskState; +import org.apache.helix.util.HelixUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,16 +86,21 @@ public class JobMonitor extends DynamicMBeanProvider { // Instantiate histogram dynamic metrics _jobLatencyGauge = new HistogramDynamicMetric("JobLatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); - _submissionToProcessDelayGauge = - new HistogramDynamicMetric("SubmissionToProcessDelayGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); - _submissionToScheduleDelayGauge = - new HistogramDynamicMetric("SubmissionToScheduleDelayGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); - _controllerInducedDelayGauge = - new HistogramDynamicMetric("ControllerInducedDelayGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); + _submissionToProcessDelayGauge = new HistogramDynamicMetric("SubmissionToProcessDelayGauge", + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); + _submissionToScheduleDelayGauge = new HistogramDynamicMetric("SubmissionToScheduleDelayGauge", + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); + _controllerInducedDelayGauge = new HistogramDynamicMetric("ControllerInducedDelayGauge", + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); } @Override diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java index a496eab..81ca719 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/MessageLatencyMonitor.java @@ -27,6 +27,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; import javax.management.JMException; import java.util.ArrayList; @@ -49,7 +50,9 @@ public class MessageLatencyMonitor extends DynamicMBeanProvider { "MessageLatency"); _messageLatencyGauge = new HistogramDynamicMetric("MessagelatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _totalMessageLatency = new SimpleDynamicMetric("TotalMessageLatency", 0l); _totalMessageCount = new SimpleDynamicMetric("TotalMessageCount", 0l); } 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 c66ae2d..e32e012 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 @@ -38,6 +38,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; public class ResourceMonitor extends DynamicMBeanProvider { @@ -140,14 +141,20 @@ public class ResourceMonitor extends DynamicMBeanProvider { _partitionTopStateHandoffDurationGauge = new HistogramDynamicMetric("PartitionTopStateHandoffDurationGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); _partitionTopStateHandoffHelixLatencyGauge = new HistogramDynamicMetric("PartitionTopStateHandoffHelixLatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); _partitionTopStateNonGracefulHandoffDurationGauge = new HistogramDynamicMetric("PartitionTopStateNonGracefulHandoffGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); _totalMessageReceived = new SimpleDynamicMetric("TotalMessageReceived", 0L); _maxSinglePartitionTopStateHandoffDuration = diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/RoutingTableProviderMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/RoutingTableProviderMonitor.java index 325ea1b..ef4c90e 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/RoutingTableProviderMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/RoutingTableProviderMonitor.java @@ -26,6 +26,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; import javax.management.JMException; import javax.management.MalformedObjectNameException; @@ -60,13 +61,17 @@ public class RoutingTableProviderMonitor extends DynamicMBeanProvider { _propertyType.name()); _dataRefreshLatencyGauge = new HistogramDynamicMetric("DataRefreshLatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _callbackCounter = new SimpleDynamicMetric("CallbackCounter", 0l); _eventQueueSizeGauge = new SimpleDynamicMetric("EventQueueSizeGauge", 0l); _dataRefreshCounter = new SimpleDynamicMetric("DataRefreshCounter", 0l); if (propertyType.equals(PropertyType.CURRENTSTATES)) { - _statePropLatencyGauge = new HistogramDynamicMetric("StatePropagationLatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + _statePropLatencyGauge = new HistogramDynamicMetric("StatePropagationLatencyGauge", + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); } } diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java index 93ace95..2473378 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/StateTransitionStatMonitor.java @@ -34,6 +34,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,13 +65,17 @@ public class StateTransitionStatMonitor extends DynamicMBeanProvider { _totalSuccessTransitionCounter = new SimpleDynamicMetric<>("TotalSuccessTransitionCounter", 0L); _transitionLatencyGauge = new HistogramDynamicMetric("TransitionLatencyGauge", new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _transitionExecutionLatencyGauge = new HistogramDynamicMetric("TransitionExecutionLatencyGauge", - new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _transitionMessageLatency = new HistogramDynamicMetric("TransitionMessageLatencyGauge", - new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); } @Override diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java index 6cd0cd5..869aa88 100644 --- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java +++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ZkClientPathMonitor.java @@ -31,6 +31,7 @@ import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMBeanProvider; import org.apache.helix.monitoring.mbeans.dynamicMBeans.DynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.HistogramDynamicMetric; import org.apache.helix.monitoring.mbeans.dynamicMBeans.SimpleDynamicMetric; +import org.apache.helix.util.HelixUtil; public class ZkClientPathMonitor extends DynamicMBeanProvider { public static final String MONITOR_PATH = "PATH"; @@ -128,21 +129,27 @@ public class ZkClientPathMonitor extends DynamicMBeanProvider { _readCounter = new SimpleDynamicMetric(PredefinedMetricDomains.ReadCounter.name(), 0l); _readLatencyGauge = new HistogramDynamicMetric(PredefinedMetricDomains.ReadLatencyGauge.name(), - new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _writeLatencyGauge = new HistogramDynamicMetric(PredefinedMetricDomains.WriteLatencyGauge.name(), new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); _readBytesGauge = new HistogramDynamicMetric(PredefinedMetricDomains.ReadBytesGauge.name(), - new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _writeBytesGauge = new HistogramDynamicMetric(PredefinedMetricDomains.WriteBytesGauge.name(), - new Histogram( - new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), + TimeUnit.MILLISECONDS))); _dataPropagationLatencyGauge = new HistogramDynamicMetric(PredefinedMetricDomains.DataPropagationLatencyGuage.name(), - new Histogram(new SlidingTimeWindowArrayReservoir(DEFAULT_RESET_INTERVAL_MS, - TimeUnit.MILLISECONDS))); + new Histogram(new SlidingTimeWindowArrayReservoir(HelixUtil + .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, + DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); } public ZkClientPathMonitor register() throws JMException { 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 6277c49..d371571 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 @@ -51,6 +51,7 @@ import org.slf4j.LoggerFactory; public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNameProvider { protected final Logger _logger = LoggerFactory.getLogger(getClass()); protected static final long DEFAULT_RESET_INTERVAL_MS = 60 * 60 * 1000; // Reset time every hour + protected static final String RESET_INTERVAL_SYSTEM_PROPERTY_KEY = "reservoir.length.ms"; private static String SENSOR_NAME_TAG = "SensorName"; private static String DEFAULT_DESCRIPTION = "Information on the management interface of the MBean";
