Basically in your bolts prepare() method you'd want to do something like
the following:
// Create new counter metric to count how many XYZ
counterMetric = new CountMetric();
topologyContext.registerMetric("my_count_metric", counterMetric, 60);
where 60 is how often the metric is published, in seconds.
And then later within your bolt when you want to increment the count
you'd just do:
counterMetric.incrBy(1);
Where 1 is however many you want to increment the metric by.
On Fri, Aug 5, 2016 at 10:01 AM, Junguk Cho <[email protected]> wrote:
> Hi,
>
> Is there an example to show how to use worker level metric?
> There is a document (http://storm.apache.org/releases/2.0.0-SNAPSHOT/
> Metrics.html), but I am not clear how to use it.
>
> Thanks,
> Junguk
>