Apache Flink - 显示计数器值但未显示仪表值

Apache Flink - Counter value displayed but meter values not displayed

我们在 EMR - Yarn 上使用 Flink 1.8.0 和 运行 它并想测量吞吐量.

  1. 因为我们的运算符是链接的,所以我们在代码中添加了计量器和计数器 - 本质上是一个异步运算符,它使用运动作为源和同步进行 API 调用。在 Application Master 即 Flink 的 web UI 中,我们能够获取计数器的值但不能获取计量器的值。
public class AsyncClass extends RichAsyncFunction<String, String> {

    private transient Counter counter;

    private transient Meter meter;

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

        this.counter = getRuntimeContext()
                  .getMetricGroup()
                  .counter("myCounter");

        this.meter = getRuntimeContext()
                .getMetricGroup()
                .meter("myMeter", new DropwizardMeterWrapper(new com.codahale.metrics.Meter()));
    }

    @Override
    public void close() throws Exception {
        super.close();
        ExecutorUtils.gracefulShutdown(20000, TimeUnit.MILLISECONDS, executorService);
    }



    @Override
    public void asyncInvoke(String key, final ResultFuture<String> resultFuture) throws Exception {


        resultFuture.complete(key);
        this.meter.markEvent();
        this.counter.inc();

    }
}
  1. 要衡量应用程序的完整吞吐量,我们显然需要所有任务管理器的总吞吐量。使用仪表,我们能够获得各个任务管理器的指标。有什么办法可以在运营商层面衡量吗?

原来仪表显示的是整数值,并且速率以小数形式测量。当我的负载恒定为每秒 1 个事件时,它实际上被测量为 0.9xxx,因此每秒仅显示 0 个事件。