Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.9.2-incubating
-
None
Description
In a Bolt's prepare method, we can register metrics twice with the same name, using different timeBucketSizeInSecs parameter, like this:
public void prepare(Map stormConf, TopologyContext context)
{ mapper = new ObjectMapper(); cMetric = new MTCountMetric(); context.registerMetric("JavaBoltCount", cMetric, 120); ccMetric = new MTCountMetric(); context.registerMetric("JavaBoltCount", ccMetric, 60); }----------------------------------------------------------------------------------------
This is caused by TopologyContext's registerMetric. In TopologyContext, all registered metrics holds in a map defined below:
private Map<Integer,Map<Integer, Map<String, IMetric>>> _registeredMetrics;
timeBucketSizeInSecs ----> __taskId ----> metricName ----> metirc