Storm exposes a metrics interface to report summary statistics across the full topology. It's used internally to track the numbers you see in the Nimbus UI console: counts of executes and acks; average process latency per bolt; worker heap usage; and so forth.
Metrics have to implement just one method,
getValueAndReset -- do any remaining work to find the summary value, and reset back to an initial state. For example, the MeanReducer divides the running total by its running count to find the mean, then initializes both values back to zero.
Storm gives you these metric types:
incr()to increment by one,
incrBy(n)to add/subtract the given number.
reduce()method. (It accepts
Longvalues, and maintains the internal average as a
Double.) Despite his reputation, the MeanReducer is actually a pretty nice guy in person.
The builtin metrics instrument Storm itself.
builtin_metrics.clj sets up data structures for the built-in metrics, and facade methods that the other framework components can use to update them. The metrics themselves are calculated in the calling code -- see for example