storm-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Powis <spo...@salesforce.com>
Subject Re: Example of worker level metric?
Date Fri, 05 Aug 2016 14:07:11 GMT
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 <jmanbal@gmail.com> 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
>

Mime
View raw message