Apache Flink - Question about metric registry and reporter and context information

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

Apache Flink - Question about metric registry and reporter and context information

M Singh
Hi:

I wanted to find if the metric reporter and registry are instantiated per task manager (which is a single JVM process) or per slot.  I believe it per task manager (JVM process) but just wanted to confirm.

Also, is there a way to access context information (eg: task manager name etc) in the metric reporter or registry just like in the rich function open method ?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Apache Flink - Question about metric registry and reporter and context information

Yun Tang
Hi

1) Yes, the metrics reporter was instantiated per task manager, you could refer to [1] to confirm.

2) You could get your runtime context by calling #getRuntimeContext() in RichFunction. And you could get your metric group within runtimeContext then. The task manager name could be found by #getAllVariables() within MetricGroup.



Best
Yun Tang


From: M Singh <[hidden email]>
Sent: Saturday, June 15, 2019 2:13
To: User
Subject: Apache Flink - Question about metric registry and reporter and context information
 
Hi:

I wanted to find if the metric reporter and registry are instantiated per task manager (which is a single JVM process) or per slot.  I believe it per task manager (JVM process) but just wanted to confirm.

Also, is there a way to access context information (eg: task manager name etc) in the metric reporter or registry just like in the rich function open method ?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Apache Flink - Question about metric registry and reporter and context information

Chesnay Schepler
You cannot access context information in the metric reporter itself in a nice way. You can wait for the first metric to be registered, and then extract arbitrary metric variables from the metric group.

On 15/06/2019 19:31, Yun Tang wrote:
Hi

1) Yes, the metrics reporter was instantiated per task manager, you could refer to [1] to confirm.

2) You could get your runtime context by calling #getRuntimeContext() in RichFunction. And you could get your metric group within runtimeContext then. The task manager name could be found by #getAllVariables() within MetricGroup.



Best
Yun Tang


From: M Singh [hidden email]
Sent: Saturday, June 15, 2019 2:13
To: User
Subject: Apache Flink - Question about metric registry and reporter and context information
 
Hi:

I wanted to find if the metric reporter and registry are instantiated per task manager (which is a single JVM process) or per slot.  I believe it per task manager (JVM process) but just wanted to confirm.

Also, is there a way to access context information (eg: task manager name etc) in the metric reporter or registry just like in the rich function open method ?

Thanks