Apache Flink仪表板未显示指标 [英] Apache Flink Dashboard not showing metrics

查看:67
本文介绍了Apache Flink仪表板未显示指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下非常简单的Apache Flink管道,我希望为其获取一些指标,如

现在我问自己我在做什么错?是否缺少一些配置参数,或者这不是在仪表板中查看该指标的正确位置?有人可以建议或至少指向我提供更多信息的资源吗?

解决方案

我相信这是您已经向地图运算符添加了运算符度量,但是Web ui正在显示任务度量.(对于这种简单的,令人尴尬的并行作业,源,地图和接收器运算符已链接在一起,成为一个任务.)

要检查已添加的该指标,可以使用REST API或任何指标报告器.我认为,如果您通过

禁用操作员链接,它也可能会显示在网络用户界面中

  env.disableOperatorChaining(); 

I have the following very simple Apache Flink Pipeline for which I would like to get some metrics, as explained in the Apache Flink documentation, via the Apache Flink Dashboard:

import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.metrics.Counter;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.source.RichSourceFunction;

public class Pipeline {

    public static void main(String[] args) throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.addSource(new RichSourceFunction<String>() {
            private static final long serialVersionUID = 3990963645875188158L;
            private boolean notCanceled = true;

            @Override
            public void run(SourceContext<String> ctx) throws Exception {
                while (notCanceled) {
                    ctx.collect("test");
                }
            }

            @Override
            public void cancel() {
                notCanceled = false;
            }
        }).map(new RichMapFunction<String, String>() {
            private static final long serialVersionUID = 1L;
            private transient Counter counter;

            @Override
            public void open(Configuration parameters) throws Exception {
                super.open(parameters);
                this.counter = getRuntimeContext()
                        .getMetricGroup()
                        .counter("myCounter");
            }

            @Override
            public String map(String value) throws Exception {
                this.counter.inc();
                return "mappedtext";
            }
        }).print();

        env.execute();
    }

}

I do run that Pipeline using the Docker Setup available via Docker-Hub. Everything uses Apache Flink 1.10.0. The Pipeline runs fine, but when I try to view my metric I only get:

Now I ask myself what am I doing wrong? Is there some configuration parameter I am missing or is this not the correct place to view that metric in the dashboard? Can someone please advise or at least point me to a resource, where I would get more information?

解决方案

I believe what's going on is that you have added an operator metric to the map operator, but the web ui is displaying task metrics. (In the case of this simple, embarrassingly parallel job, the source, map, and sink operators have been chained together into a single task.)

To inspect this metric you've added, you could use the REST API, or any of the metrics reporters. I think it may also show up in the web UI if you disable operator chaining via

    env.disableOperatorChaining();

这篇关于Apache Flink仪表板未显示指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆