Hi David,

I think it is not strictly required that you register the metric in the
open method. It is just convenient because otherwise you have to make sure
that you register the metric only once (e.g. when doing it in the map
function).

What you need in order to register a metric is the runtime context which
you get if you implement a RichFunction:

getRuntimeContext().getMetricGroup().gauge("MyGauge", new Gauge<Integer>() {
    @Override
    public Integer getValue() {
      return valueToExpose;
    }
  });

Cheers,
Till

On Fri, Jun 21, 2019 at 12:36 AM David Morin <morin.david....@gmail.com>
wrote:

> Hi,
>
> I want to create one metric related to the number of errors but in fact I
> would like to add some contextual labels ?
> What is the best way to do that ? gauge ?
> How to create this kind of metric dynamically during the run of the task
> (because open method is not possible because too early) ?
> Thanks in advance
>
> David
>

Reply via email to