Github user wuchong commented on a diff in the pull request:

    https://github.com/apache/storm/pull/881#discussion_r45027342
  
    --- Diff: 
storm-core/src/jvm/backtype/storm/metric/internal/LatencyStatAndMetric.java ---
    @@ -242,7 +248,7 @@ private synchronized void rotate(long lat, long count, 
long timeSpent, long targ
                 totalCount += countBuckets[i];
                 timeNeeded -= bucketTime[i];
             }
    -        return ((double)totalLat)/totalCount;
    +        return totalCount > 0 ? ((double)totalLat)/totalCount : 0.0;
    --- End diff --
    
    Maybe we can pull the code out into a function named like `div-or-0`, as it 
appears more than once.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to