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

    https://github.com/apache/storm/pull/2203#discussion_r160801985
  
    --- Diff: storm-core/src/clj/org/apache/storm/daemon/executor.clj ---
    @@ -446,7 +451,7 @@
         (.ack spout msg-id)
         (task/apply-hooks (:user-context task-data) .spoutAck (SpoutAckInfo. 
msg-id task-id time-delta))
         (when time-delta
    -      (stats/spout-acked-tuple! (:stats executor-data) (:stream 
tuple-info) time-delta))))
    +      (stats/spout-acked-tuple! (:stats executor-data) 
(StormMetricRegistry/counter "acked" (:worker-context executor-data) 
(:component-id executor-data) (pr-str (:executor-id executor-data)) (:stream 
tuple-info)) (:stream tuple-info) time-delta))))
    --- End diff --
    
    I was thinking that the map would have just the stream id as the key, but 
the name of the metric could be anything.  i.e.
    
    ```
    public class TaskStats {
       ConcurrentMap<String, Counter> ackByStream = ...;
       TaskStats(String topoId, String componentId, int taskid, int workerPort) 
{
            ///Save these away...
       }
    
       public Counter getAck(String streamId) {
          Counter c = ackByStream.get(streamId);
           if (c == null) {
               c = StormMetricRegistry.counter("acked", topoId, componentId, 
taskId, streamId);
               ackByStream.put(streamId, c);
           }
           return c;
       }
    }
    ```
    
    We could then have a map of TaskStats in the executor-data, one for each 
executorId the executor is over.  Or like I said if you want to go crazy you 
could take the list of known streams (inbound and outbound depending on the 
stat) and populate the metrics in the constructor, but it is not necessary. 


---

Reply via email to