Search code examples
apache-flinkflink-streamingflink-cep

Naming operators, sources, sinks and patterns to be shown in Flink Execution Plan UI


I just want to give names to operators and sources. Let's take an example

enter image description here

This is a screenshot of the execution plan, that I have taken form Flink Dashboard. Here I have 2 sources of DataStreams and then I am joining them. My question is that, can I name these sources as EcgStream and Sp02 Stream for example and Join as Join1?

Reason I am asking this question is because it makes visualization easier. Also, as I was going though Opsclarity page , at the end of the page, they have mentioned the following

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.

I have another question as well , which is that when ever I make a pattern for CEP , the execution plan UI just show it as a pattern. Is there any way it show what that pattern is like A B+ C? D . Also in case we have multiple patterns we should be able to name than as Patterns{1..n}


Solution

  • As suggested by @alpinegizmo , I have added UID to source stream as follows

    // 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");
    

    But execution Graph dont show these uid's

    enter image description here

    Also the result of below sout is 3

      System.out.println("id for stream 1 is " + stream1.getId());