Ethanlm commented on a change in pull request #3333:
URL: https://github.com/apache/storm/pull/3333#discussion_r497190832
##########
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:
`TEN_MIN_IN_SECONDS_STR` can be a constant in this class itself. But
this is not important.
----------------------------------------------------------------
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]