Ethanlm commented on a change in pull request #3333:
URL: https://github.com/apache/storm/pull/3333#discussion_r497562715
##########
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:
There is another similar class `MultiLatencyStat`. It doesn't feel right
to use `MultiCountStat.TEN_MIN_IN_SECONDS_STR` for `MultiLatencyStat`. But this
is just personal preference and we can leave this to the future. I am okay with
current change.
----------------------------------------------------------------
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:
[email protected]