You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by James Kebinger <jk...@hubspot.com> on 2014/01/22 02:28:33 UTC

How does one map a component id back to the name of a component in trident? (implementing a metrics consumer)

I'm trying to implement a metrics consumer for a Trident topology, so I'm
using the example LoggingMetricsConsumer as an example. I see that each
call to handleDataPoints passes in an instance of TaskInfo containing a
source component id. How do I map that component id to the name of a bolt
so that I can disambiguate metrics that could possibly have the same name
from multiple bolts?

The task id and component id from the output are "6:b-0". I see that i can
get an instance of ComponentCommon at that point, but not sure what to do
with that.

It looks like in storm, bolts can be assigned names, but maybe that's not
the case in trident?


Here's a line of the output with my custom metric in it (hostname removed)
10725423 [Thread-26-__metricsbacktype.storm.metric.LoggingMetricsConsumer]
INFO  backtype.storm.metric.LoggingMetricsConsumer - 1390352500
mashentuck.hostname.com:1     6:b-0         lag                     0.6

Thanks

Re: How does one map a component id back to the name of a component in trident? (implementing a metrics consumer)

Posted by Mark Greene <ma...@evertrue.com>.
This isn't as elegant of a solution as it doesn't take advantage of the new
features you mention in 0.9 but I simply implement ITaskHook with a
constructor that takes in a sensible name for bolts and spouts. This name
is used to dump metrics into Codahale and then the Codahale
GraphiteReporter ships the metics over periodically.


On Tue, Jan 21, 2014 at 8:28 PM, James Kebinger <jk...@hubspot.com>wrote:

> I'm trying to implement a metrics consumer for a Trident topology, so I'm
> using the example LoggingMetricsConsumer as an example. I see that each
> call to handleDataPoints passes in an instance of TaskInfo containing a
> source component id. How do I map that component id to the name of a bolt
> so that I can disambiguate metrics that could possibly have the same name
> from multiple bolts?
>
> The task id and component id from the output are "6:b-0". I see that i can
> get an instance of ComponentCommon at that point, but not sure what to do
> with that.
>
> It looks like in storm, bolts can be assigned names, but maybe that's not
> the case in trident?
>
>
> Here's a line of the output with my custom metric in it (hostname removed)
> 10725423 [Thread-26-__metricsbacktype.storm.metric.LoggingMetricsConsumer]
> INFO  backtype.storm.metric.LoggingMetricsConsumer - 1390352500
> mashentuck.hostname.com:1     6:b-0         lag                     0.6
>
> Thanks
>
>
>
>