Custom Metrics in Windowed AggregateFunction

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Metrics in Windowed AggregateFunction

chiggi_dev
Hi,

I am writing a Flink job for aggregating events in a window. 

I am trying to use the AggregateFunction implementation for this. 

Now, since WindowedStream does not allow a RichAggregateFunction for aggregation, I cant use the RuntimeContext to get the Metric group. 

I dont even see any other way of accessing the Metric Group in a non-rich function implementation?

Is there any way around here? 

Any help appreciated.

Thanks,

Chirag
Reply | Threaded
Open this post in threaded view
|

Re: Custom Metrics in Windowed AggregateFunction

Dawid Wysakowicz-2

Hi Chirag,

I am afraid you are right you cannot access metrics from within AggregateFunction in WindowedStream. You can though use rich variant of WindowFunction, which is invoked for every window with the results of AggregateFunction. Would that be enough for your use case to use .aggregate(aggregateFunction, windowFunction) and register metrics in the windowFunction?

Best,

Dawid

On 19/12/2018 04:30, Chirag Dewan wrote:
Hi,

I am writing a Flink job for aggregating events in a window. 

I am trying to use the AggregateFunction implementation for this. 

Now, since WindowedStream does not allow a RichAggregateFunction for aggregation, I cant use the RuntimeContext to get the Metric group. 

I dont even see any other way of accessing the Metric Group in a non-rich function implementation?

Is there any way around here? 

Any help appreciated.

Thanks,

Chirag

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Custom Metrics in Windowed AggregateFunction

chiggi_dev
That was my first alternative actually :)

That works well for per window metrics. And though it fits perfectly for smaller windows, it might not be frequent enough for larger window sizes. 

Thanks,

Chirag 

On Wednesday, 19 December, 2018, 4:15:41 PM IST, Dawid Wysakowicz <[hidden email]> wrote:


Hi Chirag,

I am afraid you are right you cannot access metrics from within AggregateFunction in WindowedStream. You can though use rich variant of WindowFunction, which is invoked for every window with the results of AggregateFunction. Would that be enough for your use case to use .aggregate(aggregateFunction, windowFunction) and register metrics in the windowFunction?

Best,

Dawid

On 19/12/2018 04:30, Chirag Dewan wrote:
Hi,

I am writing a Flink job for aggregating events in a window. 

I am trying to use the AggregateFunction implementation for this. 

Now, since WindowedStream does not allow a RichAggregateFunction for aggregation, I cant use the RuntimeContext to get the Metric group. 

I dont even see any other way of accessing the Metric Group in a non-rich function implementation?

Is there any way around here? 

Any help appreciated.

Thanks,

Chirag