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

    https://github.com/apache/storm/pull/881#discussion_r45251619
  
    --- Diff: storm-core/src/clj/backtype/storm/stats.clj ---
    @@ -335,30 +358,21 @@
     (defn- agg-bolt-streams-lat-and-count
       "Aggregates number executed and process & execute latencies."
       [idk->exec-avg idk->proc-avg idk->executed]
    -  {:pre (apply = (map #(set (keys %))
    -                      [idk->exec-avg
    -                       idk->proc-avg
    -                       idk->executed]))}
    -  (letfn [(weight-avg [id avg] (let [num-e (idk->executed id)]
    -                                   (if (and avg num-e)
    -                                     (* avg num-e)
    -                                     0)))]
    +  (letfn [(weight-avg [id avg]
    +            (let [num-e (idk->executed id)]
    +              (product-or-0 avg num-e)))]
         (into {}
           (for [k (keys idk->exec-avg)]
    -        [k {:executeLatencyTotal (weight-avg k (idk->exec-avg k))
    -            :processLatencyTotal (weight-avg k (idk->proc-avg k))
    +        [k {:executeLatencyTotal (weight-avg k (get idk->exec-avg k))
    +            :processLatencyTotal (weight-avg k (get idk->proc-avg k))
    --- End diff --
    
    ```
    user=> (def nilmap nil)
    #'user/nilmap
    user=> (get nilmap :somekey)
    nil
    user=> (nilmap :somekey)
    NullPointerException   user/eval3 (NO_SOURCE_FILE:4)
    ```
    `get` guards against the map itself is `nil`.


---
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