flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiewen Shao <jiewens...@gmail.com>
Subject need instruction on how the Flink metric works
Date Mon, 18 Sep 2017 02:27:28 GMT
I'm new to flink and I have read
https://ci.apache.org/projects/flink/flink-docs-release-1.3/monitoring/metrics.html,
I am still unclear where do I read the metrics I added.

for example,

public static void main(String[] args) throws Exception {


        StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(2);



        List<String> wordList = Arrays.asList("Hive", "Presto", "Impala",
"Parquet","ORC","Hadoop", "Flink", "Spark", "Storm", "Tez", "Flink");


        DataStreamSource<String> source = env.fromCollection(wordList);

        DataStream<Tuple2<String, Integer>> dataStream = env.fromCollection(
wordList).map(new WordLengthCounter());

        dataStream.print();

        env.execute();

    }


and


public class WordLengthCounter extends RichMapFunction<String,
Tuple2<String, Integer>> {


private static final long serialVersionUID = 1L;

private Counter counter;


@Override

  public void open(Configuration config) {

    this.counter = getRuntimeContext()

      .getMetricGroup()

      .counter("myCounter");

  }


@Override

public Tuple2<String, Integer> map(String value) throws Exception {

this.counter.inc();

return new Tuple2<String, Integer>(value, value.length());

}

}


Now, where do I see the counter? Sorry for the naive question

can anyone point me to any good end-to-end "hello world" example for flink
metrics.

Mime
View raw message