You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by 이승진 <sw...@navercorp.com> on 2014/08/26 14:18:39 UTC

MultiCountMetric is empty

Dear all,
 
Imagine there a 3 bolts A,B and C linked to one another and one metric consumer(IMetricConsumer implementation)
 
 
Inside the execute method in each bolt, there is a small piece of code sending metric to consumer
AMetric.scope("cnt").incr();
BMetric.scope("cnt").incr();
CMetric.scope("cnt").incr();
 
In prepare method of each bolt, I declared each metric like below
BMetric = new MultiCountMetric();
context.registerMetric("B", BMetric, 2);

 
In topology declaration, I registered metric consumer class obviously like below
conf.registerMetricsConsumer(Consumer.class, 2);


In handleDataPoints method of consumer, I tried to aggregate metric like belowfor (IMetricsConsumer.DataPoint p : dataPoints) {
if (p.name.equals("A")) {
System.out.println(((Map) p.value).get("cnt");
}
else if (p.name.equals("B")) {
System.out.println(((Map) p.value).get("cnt");
} 
else if (p.name.equals("C")) {
System.out.println(((Map) p.value).get("cnt");
}
}
 
but here, metric from Bolt A arrives as expected but other than that, p.value is empty
 
If there is a mistake, can you tell me what's the reason for this?
 
 
Thanks in advance.