【问题标题】:Apache Flink - Counter value displayed but meter values not displayedApache Flink - 显示计数器值但未显示仪表值
【发布时间】:2020-02-17 15:56:49
【问题描述】:

我们正在使用 Flink 1.8.0 并在 EMR - Yarn 上运行它,并希望测量吞吐量。

  1. 因为我们的运算符是链式的,所以我们在代码中添加了计量器和计数器 - 本质上是一个异步运算符,它使用 kinesis 作为源和同步进行 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. 要衡量应用程序的完整吞吐量,我们显然需要所有任务管理器的吞吐量。使用计量器,我们可以获得各个任务管理器的指标。有没有办法在运营商层面衡量?

【问题讨论】:

  • 您检查过日志文件是否有任何警告? (也许在启用调试日志记录的情况下重试)您是在用户 jar 中捆绑 flink-metrics-dropwizard 还是放在 /lib 中?如果您使用自定义虚拟仪表实现,它是否有效?
  • @Chesnay Schepler,感谢您的回复。我检查了地图运算符的简单 RichMapFunciton 实现,但它在那里也不起作用。我们正在将 dropwizard 依赖项打包到 user-jar 本身中。

标签: apache-flink flink-streaming


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2020-12-31
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多