You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by GitBox <gi...@apache.org> on 2020/09/30 13:50:17 UTC

[GitHub] [storm] agresch commented on a change in pull request #3333: STORM-3697 add capacity metric

agresch commented on a change in pull request #3333:
URL: https://github.com/apache/storm/pull/3333#discussion_r497525277



##########
File path: storm-client/src/jvm/org/apache/storm/stats/BoltExecutorStats.java
##########
@@ -53,10 +58,53 @@ public void cleanupStats() {
         super.cleanupStats();
     }
 
-    public void boltExecuteTuple(String component, String stream, long latencyMs) {
+    public void boltExecuteTuple(String component, String stream, long latencyMs, long workerUptimeSecs,
+                                 Task firstExecutorTask) {
         List key = Lists.newArrayList(component, stream);
         this.getExecuted().incBy(key, this.rate);
         this.getExecuteLatencies().record(key, latencyMs);
+
+        // Calculate capacity:  This is really for the whole executor, but we will use the executor's first task
+        // for reporting the metric.
+        double capacity = calculateCapacity(workerUptimeSecs);
+        firstExecutorTask.getTaskMetrics().setCapacity(capacity);
+    }
+
+    private double calculateCapacity(long workerUptimeSecs) {
+        if (workerUptimeSecs > 0) {
+            Map<String, Double> execAvg = valueStat(this.getExecuteLatencies()).get(MultiCountStat.TEN_MIN_IN_SECONDS_STR);

Review comment:
       I was going to use MultiCountStat.TEN_MIN_IN_SECONDS_STR to replace the one in StatsUtil, which is in storm-server for more general usage, but didn't replace the other usages to keep a smaller review.




----------------------------------------------------------------
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:
users@infra.apache.org