我第一次用counters,已经在map中写了
if(null != strs && strs.length == 3) {
context.getCounter("Line Quality statistics", "Nice Line Count").increment(1);
outkey.set(strs[2]);
context.write(outkey, outval);
}
else {
context.getCounter("Line Quality statistics", "Bad Line Count").increment(1);
}
在run里写了
if(con){
Counters counters = job.getCounters();
System.out.println(job.getJobName() + "'s counter count : " + counters.countCounters());
for (CounterGroup counterGroup : counters) {
System.out.println("\t" + counterGroup.getDisplayName());
for (Counter counter : counterGroup) {
System.out.println("\t\t" + counter.getDisplayName() + "=" + counter.getValue());
}
}
}
counters却没有输出。。请问大家有遇到相似问题的吗?