> metrics may not be reported properly
They will definitely not be reported properly, because if a gauge
already exists with the same name then it will just be ignored.
On 23/11/2021 03:29, Caizhi Weng wrote:
Hi!
gauge: makes sense to define gauges inside processElement().
Although new gauges will replace old gauges with the same name in the
same metrics group, it is highly NOT recommended to do so because
metrics may not be reported properly.
But it is a little awkward if these variables are used in
classes/functions deeply nested in processElement().
Yes it is. But this is what all operators do currently. Most operators
create their metrics in the open() method and pass them around in the
processElement() method.
Lian Jiang <[email protected]> 于2021年11月23日周二 上午12:08写道:
Hi,
I want to get metrics inside a processElement() function of a
processWindowFucntion class. Below is my understanding:
*counter*: a counter variable defined inside processElement() will
be reset every time when processElement() is called
*meter*: a meter variable defined inside processElement() will be
reset every time when processElement() is called
*histogram*: a histogram variable defined inside processElement()
will be reset every time when processElement() is called
*gauge*: makes sense to define gauges inside processElement().
Is my understanding correct? I tried to define the metrics outside
processElement() and pass these variables to processElement(). But
it is a little awkward if these variables are used in
classes/functions deeply nested in processElement(). Can I make
these metrics variables available in Flink Runtime context so that
the nested classes/functions can access these variables from the
runtime context? Appreciate your guidance!