Hey Elias, Thanks for the tips. Unfortunately, it seems `Context` only have information from the element being processed ( https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/ProcessFunction.java#L91) and the RuntimeContext doesn't have access to any watermark information ( https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java#L57 ).
On Mon, Jul 30, 2018 at 10:28 PM, Elias Levy <fearsome.lucid...@gmail.com> wrote: > You can create a ProcessFunction. That gives you access to > getRuntimeContext to register metrics, to the element timestamp, and the > current watermark. Keep in mind that operators first process a record and > then process any watermark that was the result of that record, so that when > you get the current watermark from within the processElement method, the > watermark generated from that element won't be the current watermark. > > On Mon, Jul 30, 2018 at 10:33 AM Julio Biason <julio.bia...@azion.com> > wrote: > >> Hello, >> >> Our current watermark model is "some time behind the most recent seen >> element" (very close to what the docs have in "Periodic Watermark" >> https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/event_ >> timestamps_watermarks.html#with-periodic-watermarks). It fits our >> current processing model. >> >> The thing is, we want to extract information about elements appearing >> behind the watermark, to give some insight when we need to update the >> amount of time behind the most seen element we need. The problem is, I >> can't create any metrics inside the AssignerWithPeriodicWatermarks 'cause >> it has no `getRuntime()` to attach the metric. >> >> Is there any way we can count those (a ProcessFunction before the . >> assignTimestampsAndWatermarks(), maybe)? >> >> -- >> *Julio Biason*, Sofware Engineer >> *AZION* | Deliver. Accelerate. Protect. >> Office: +55 51 3083 8101 <callto:+555130838101> | Mobile: +55 51 >> <callto:+5551996209291>*99907 0554* >> > -- *Julio Biason*, Sofware Engineer *AZION* | Deliver. Accelerate. Protect. Office: +55 51 3083 8101 <callto:+555130838101> | Mobile: +55 51 <callto:+5551996209291>*99907 0554*