Hi Ahmed,
It uses "topology.builtin.metrics.bucket.size.secs"
as a time bucket and calls registerMetric on all the metrics with the
specified time bucket above.
https://storm.incubator.apache.org/apidocs/backtype/storm/task/TopologyContext.html#registerMetric%28java.lang.String,%20backtype.storm.metric.api.ICombiner,%20int%29.
Storm will then call getValueAndReset on the metric every
timeBucketSizeInSecs and the returned value is sent to all metrics
consumers.
I am not sure about using thrift api to fetch metrics ( probably
ok) but they will get you the latest metrics and as you notice they
might be changing before duration you mentioned in
"topology.builtin.metrics.bucket.size.secs".
Recommended way is to implement MetricsConsumer . Storm has
LoggingMetricsConsumer
https://github.com/apache/incubator-storm/blob/master/storm-core/src/jvm/backtype/storm/metric/LoggingMetricsConsumer.java.
Check this link on how to use that class
http://www.bigdata-cookbook.com/post/72320512609/storm-metrics-how-to.
-Harsha
On Thu, Jul 31, 2014, at 06:38 AM, Ahmed El Rheddane wrote:
> Hello,
>
> I have been using Storm for a while now. I retrieve the builtin metrics
> via a Thrift connection (I don't know if there is a better way to do
> so). I regularly fetch the metrics and I can still see changes in the
> values within durations inferior to the default 60 seconds for the
> metrics bucket size. Can anybody help me understand how does Storm use
> the value of topology.builtin.metrics.bucket.size.secs and how
> frequently does it report the stats to Nimbus?
>
> Thanks in advance.
>
> Ahmed