|
|
@ -353,9 +353,10 @@ if __name__ == "__main__": |
|
|
|
<h2>Flink</h2> |
|
|
|
<h2>Flink</h2> |
|
|
|
|
|
|
|
|
|
|
|
<p> |
|
|
|
<p> |
|
|
|
Uma coisa que eu não mencionei: Não são todos os dados |
|
|
|
Quando os registros são passados para a janela, eles são |
|
|
|
passados para as janelas; dados são agrupados e então |
|
|
|
agrupados (ao invés de conter todos os registros que se |
|
|
|
passados para as janelas. |
|
|
|
encaixam na janela, somente os valores agrupados |
|
|
|
|
|
|
|
são guardados). |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|
</section> |
|
|
@ -371,18 +372,18 @@ if __name__ == "__main__": |
|
|
|
<h2>Mr Banks</h2> |
|
|
|
<h2>Mr Banks</h2> |
|
|
|
|
|
|
|
|
|
|
|
<pre><code>source |
|
|
|
<pre><code>source |
|
|
|
.filter(new Selector(processor)).name(s"Selecting ${processor * 100}% messages") |
|
|
|
.filter(new Selector(processor)).name(s"Selecting ${processor * 100}% messages") |
|
|
|
.process(new ProcessMessages(brokenMessageTag)).name("Message Processor") |
|
|
|
.process(new ProcessMessages(brokenMessageTag)).name("Message Processor") |
|
|
|
.flatMap(new MessageSpliter).name("Get Logs") // get the lines in the message |
|
|
|
.flatMap(new MessageSpliter).name("Get Logs") // get the lines in the message |
|
|
|
.filter(new LogBrokenFilter).name("Remove broken logs") |
|
|
|
.filter(new LogBrokenFilter).name("Remove broken logs") |
|
|
|
.filter(new MissingClientFilter).name("Remove logs without clients") |
|
|
|
.filter(new MissingClientFilter).name("Remove logs without clients") |
|
|
|
.flatMap(new MetricExtractor).name("Create metrics") |
|
|
|
.flatMap(new MetricExtractor).name("Create metrics") |
|
|
|
.assignTimestampsAndWatermarks(new MetricTimestampAndWatermarks(watermarkTime)).name("Watermark") |
|
|
|
.assignTimestampsAndWatermarks(new MetricTimestampAndWatermarks(watermarkTime)).name("Watermark") |
|
|
|
.keyBy(_.key) |
|
|
|
.keyBy(_.key) |
|
|
|
.window(TumblingEventTimeWindows.of(windowTime)) |
|
|
|
.window(TumblingEventTimeWindows.of(windowTime)) |
|
|
|
.allowedLateness(latenessTime) |
|
|
|
.allowedLateness(latenessTime) |
|
|
|
.sideOutputLateData(lateMessageTag) |
|
|
|
.sideOutputLateData(lateMessageTag) |
|
|
|
.reduce(new MetricReducer(), new MetricWindowTimeMatcher()).name("Group metrics") |
|
|
|
.reduce(new MetricReducer(), new MetricWindowTimeMatcher()).name("Group metrics") |
|
|
|
</code></pre> |
|
|
|
</code></pre> |
|
|
|
</section> |
|
|
|
</section> |
|
|
|
|
|
|
|
|
|
|
|