You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by et...@apache.org on 2021/09/22 19:47:34 UTC

[storm] 01/02: [STORM-3785] Stop converting V2 rate metrics when adding to V1 (#3405)

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

ethanli pushed a commit to branch 2.2.x-branch
in repository https://gitbox.apache.org/repos/asf/storm.git

commit ee6cd75abb4704bc97039f6277776c1106361518
Author: Rui Li <ru...@verizonmedia.com>
AuthorDate: Wed Sep 22 13:25:35 2021 -0500

    [STORM-3785] Stop converting V2 rate metrics when adding to V1 (#3405)
---
 .../jvm/org/apache/storm/executor/Executor.java    | 37 +++++++++++-----------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/storm-client/src/jvm/org/apache/storm/executor/Executor.java b/storm-client/src/jvm/org/apache/storm/executor/Executor.java
index 6d5b9f2..2248c4b 100644
--- a/storm-client/src/jvm/org/apache/storm/executor/Executor.java
+++ b/storm-client/src/jvm/org/apache/storm/executor/Executor.java
@@ -379,10 +379,10 @@ public abstract class Executor implements Callable, JCQueue.Consumer {
         for (Map.Entry<String, Meter> entry : meters.entrySet()) {
             IMetricsConsumer.DataPoint dataPoint = new IMetricsConsumer.DataPoint(entry.getKey() + ".count", entry.getValue().getCount());
             dataPoints.add(dataPoint);
-            addConvertedMetric(entry.getKey(), ".m1_rate", entry.getValue().getOneMinuteRate(), dataPoints);
-            addConvertedMetric(entry.getKey(), ".m5_rate", entry.getValue().getFiveMinuteRate(), dataPoints);
-            addConvertedMetric(entry.getKey(), ".m15_rate", entry.getValue().getFifteenMinuteRate(), dataPoints);
-            addConvertedMetric(entry.getKey(), ".mean_rate", entry.getValue().getMeanRate(), dataPoints);
+            addConvertedMetric(entry.getKey(), ".m1_rate", entry.getValue().getOneMinuteRate(), dataPoints, false);
+            addConvertedMetric(entry.getKey(), ".m5_rate", entry.getValue().getFiveMinuteRate(), dataPoints, false);
+            addConvertedMetric(entry.getKey(), ".m15_rate", entry.getValue().getFifteenMinuteRate(), dataPoints, false);
+            addConvertedMetric(entry.getKey(), ".mean_rate", entry.getValue().getMeanRate(), dataPoints, false);
         }
     }
 
@@ -397,20 +397,21 @@ public abstract class Executor implements Callable, JCQueue.Consumer {
     }
 
     private void addSnapshotDatapoints(String baseName, Snapshot snapshot, List<IMetricsConsumer.DataPoint> dataPoints) {
-        addConvertedMetric(baseName, ".max", snapshot.getMax(), dataPoints);
-        addConvertedMetric(baseName, ".mean", snapshot.getMean(), dataPoints);
-        addConvertedMetric(baseName, ".min", snapshot.getMin(), dataPoints);
-        addConvertedMetric(baseName, ".stddev", snapshot.getStdDev(), dataPoints);
-        addConvertedMetric(baseName, ".p50", snapshot.getMedian(), dataPoints);
-        addConvertedMetric(baseName, ".p75", snapshot.get75thPercentile(), dataPoints);
-        addConvertedMetric(baseName, ".p95", snapshot.get95thPercentile(), dataPoints);
-        addConvertedMetric(baseName, ".p98", snapshot.get98thPercentile(), dataPoints);
-        addConvertedMetric(baseName, ".p99", snapshot.get99thPercentile(), dataPoints);
-        addConvertedMetric(baseName, ".p999", snapshot.get999thPercentile(), dataPoints);
-    }
-
-    private void addConvertedMetric(String baseName, String suffix, double value, List<IMetricsConsumer.DataPoint> dataPoints) {
-        IMetricsConsumer.DataPoint dataPoint = new IMetricsConsumer.DataPoint(baseName + suffix, convertDuration(value));
+        addConvertedMetric(baseName, ".max", snapshot.getMax(), dataPoints, true);
+        addConvertedMetric(baseName, ".mean", snapshot.getMean(), dataPoints, true);
+        addConvertedMetric(baseName, ".min", snapshot.getMin(), dataPoints, true);
+        addConvertedMetric(baseName, ".stddev", snapshot.getStdDev(), dataPoints, true);
+        addConvertedMetric(baseName, ".p50", snapshot.getMedian(), dataPoints, true);
+        addConvertedMetric(baseName, ".p75", snapshot.get75thPercentile(), dataPoints, true);
+        addConvertedMetric(baseName, ".p95", snapshot.get95thPercentile(), dataPoints, true);
+        addConvertedMetric(baseName, ".p98", snapshot.get98thPercentile(), dataPoints, true);
+        addConvertedMetric(baseName, ".p99", snapshot.get99thPercentile(), dataPoints, true);
+        addConvertedMetric(baseName, ".p999", snapshot.get999thPercentile(), dataPoints, true);
+    }
+
+    private void addConvertedMetric(String baseName, String suffix, double value, List<IMetricsConsumer.DataPoint> dataPoints, boolean needConversion) {
+        IMetricsConsumer.DataPoint dataPoint
+            = new IMetricsConsumer.DataPoint(baseName + suffix, needConversion ? convertDuration(value) : value);
         dataPoints.add(dataPoint);
     }