getting numOfRecordsIn using counters in Flink

Amarjit Singh

I want to show numRecordsIn for an operator in Flink and for doing this I have been following ppt by data artisans at here. code for the counter is given below

public static   class mapper extends  RichMapFunction<String,String>{

        public   Counter counter;

        @Override
    public void open(Configuration parameters) throws Exception {
        super.open(parameters);

        this.counter = getRuntimeContext()
                .getMetricGroup()
                .counter("numRecordsIn");
    }


    @Override
    public String map(String s) throws Exception {
        counter.inc();
        System.out.println("counter val " + counter.toString());
        return null;
    }
}

The problem is that how do I specify which operator I want to show number_of_Records_In?

Till Rohrmann

Metric counter are exposed via Flink's metric system. In order to take a look at them, you have to configure a metric reporter. A description how to register a metric reporter can be found here.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related