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.
[1]
https://github.com/apache/flink/blob/8558548a37437ab4f8049b82eb07d1b3aa6ed1f5/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java#L139
Best
Yun Tang
------------------------------------------------------------------------
*From:* M Singh <mans2si...@yahoo.com>
*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