命名要在 Flink 执行计划中显示的运算符、源、接收器和模式 UI
Naming operators, sources, sinks and patterns to be shown in Flink Execution Plan UI
我只想给运营商和来源起个名字。举个例子
这是我从 Flink Dashboard 中截取的执行计划的屏幕截图。在这里,我有 2 个 DataStreams 来源,然后我加入了它们。我的问题是,我可以将这些来源命名为 EcgStream 和 Sp02 Stream 并加入为 Join1?
我问这个问题的原因是它使可视化更容易。另外,当我浏览 Opsclarity 页面时,在页面末尾,他们提到了以下内容
Note the task_name and operator_name have been compressed so we can
still distinguish the tasks and operators correctly when latency is
aggregated across tasks and operators. But these compressed names will
not match what is seen in the Flink UI, which will show a fragment of
Scala code as the operator name. If you need these names to be
meaningful in the metric system, you should supply names in the Flink
code of your application. This compressed value only happens for those
very long default names that wouldn’t otherwise be legal metric
values.
我还有一个问题,那就是每当我为 CEP 制作模式时,执行计划 UI 只是将其显示为模式。有什么方法可以显示 A B+ C 的模式吗? D 。此外,如果我们有多个模式,我们应该能够命名为 Patterns{1..n}
要为您的运算符分配更好的名称,请参阅 the documentation. This is something you should do not just because it makes the execution plan more readable, but also because it will make your savepoints more robustly restorable as your application evolves (docs)。
根据@alpinegizmo 的建议,我已将 UID 添加到源流中,如下所示
// getting RR interval stream
DataStream<RRIntervalStreamEvent> rrIntervalStreamEventDataStream = envrionment.addSource(new RR_interval_Gen()).uid("RR interval stream");
// getting QRS interval stream
DataStream<qrsIntervalStreamEvent> qrsIntervalStreamEventDataStream = envrionment.addSource(new Qrs_interval_Gen()).uid("qrs Interval stream");
但是执行图不显示这些 uid
下面sout
的结果也是3
System.out.println("id for stream 1 is " + stream1.getId());
此问题已通过使用 name()
而不是 uid()
解决,如下所示
// getting RR interval stream
DataStream<RRIntervalStreamEvent> rrIntervalStreamEventDataStream = envrionment.addSource(new RR_interval_Gen()).name("RR Interval stream");
System.out.println("getting transformation for stream 1 = " + rrIntervalStreamEventDataStream.getTransformation());
// getting QRS interval stream
DataStream<qrsIntervalStreamEvent> qrsIntervalStreamEventDataStream = envrionment.addSource(new Qrs_interval_Gen()).name("qrs Interval stream");
输出图如下所示
我只想给运营商和来源起个名字。举个例子
这是我从 Flink Dashboard 中截取的执行计划的屏幕截图。在这里,我有 2 个 DataStreams 来源,然后我加入了它们。我的问题是,我可以将这些来源命名为 EcgStream 和 Sp02 Stream 并加入为 Join1?
我问这个问题的原因是它使可视化更容易。另外,当我浏览 Opsclarity 页面时,在页面末尾,他们提到了以下内容
Note the task_name and operator_name have been compressed so we can still distinguish the tasks and operators correctly when latency is aggregated across tasks and operators. But these compressed names will not match what is seen in the Flink UI, which will show a fragment of Scala code as the operator name. If you need these names to be meaningful in the metric system, you should supply names in the Flink code of your application. This compressed value only happens for those very long default names that wouldn’t otherwise be legal metric values.
我还有一个问题,那就是每当我为 CEP 制作模式时,执行计划 UI 只是将其显示为模式。有什么方法可以显示 A B+ C 的模式吗? D 。此外,如果我们有多个模式,我们应该能够命名为 Patterns{1..n}
要为您的运算符分配更好的名称,请参阅 the documentation. This is something you should do not just because it makes the execution plan more readable, but also because it will make your savepoints more robustly restorable as your application evolves (docs)。
根据@alpinegizmo 的建议,我已将 UID 添加到源流中,如下所示
// getting RR interval stream
DataStream<RRIntervalStreamEvent> rrIntervalStreamEventDataStream = envrionment.addSource(new RR_interval_Gen()).uid("RR interval stream");
// getting QRS interval stream
DataStream<qrsIntervalStreamEvent> qrsIntervalStreamEventDataStream = envrionment.addSource(new Qrs_interval_Gen()).uid("qrs Interval stream");
但是执行图不显示这些 uid
下面sout
的结果也是3
System.out.println("id for stream 1 is " + stream1.getId());
此问题已通过使用 name()
而不是 uid()
解决,如下所示
// getting RR interval stream
DataStream<RRIntervalStreamEvent> rrIntervalStreamEventDataStream = envrionment.addSource(new RR_interval_Gen()).name("RR Interval stream");
System.out.println("getting transformation for stream 1 = " + rrIntervalStreamEventDataStream.getTransformation());
// getting QRS interval stream
DataStream<qrsIntervalStreamEvent> qrsIntervalStreamEventDataStream = envrionment.addSource(new Qrs_interval_Gen()).name("qrs Interval stream");
输出图如下所示