我正在尝试在Flink中添加一个计数器here,但问题是counter.inc()返回void而不是Integer。我的指标代码如下:
private static class myMetric extends RichMapFunction<String,Integer>
{
private Counter counter ;
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
this.getRuntimeContext().
getMetricGroup().
counter("countit");
}
@Override
public Integer map(String s) throws Exception {
return this.counter.inc();
}