Hi John, No worries. addMetric throws an exception which needs to be handled. This new method removes that need similar to what you have done for the sensor method.
Thanks! Sagar. On Tue, May 24, 2022 at 8:19 PM Guozhang Wang <wangg...@gmail.com> wrote: > +1. Thanks Sagar. > > Guozhang > > On Tue, May 24, 2022 at 7:31 AM John Roesler <vvcep...@apache.org> wrote: > > > Hi again Sagar, > > > > My apologies; I was thinking of the `sensor` method: > > org.apache.kafka.common.metrics.Metrics#sensor(java.lang.String, > > org.apache.kafka.common.metrics.MetricConfig, long, > > org.apache.kafka.common.metrics.Sensor.RecordingLevel, > > org.apache.kafka.common.metrics.Sensor...) > > > > I'm in favor of your KIP. Also, sorry for responding to the VOTE thread > > instead of DISCUSS. > > > > I'm +1 (binding) > > -John > > > > On Tue, May 24, 2022, at 09:10, John Roesler wrote: > > > Hi Sagar, > > > > > > Thanks for the KIP! > > > > > > I’m not at my computer right now, but I think I confronted a similar > > > problem a while back for the Streams metrics. I think that I already > > > made the “addMetric” method to be idempotent, so if it’s already > > > registered, the call just returns the old one instead of creating a new > > > one. That way, you no longer have to check up front if the metric is > > > registered. I think that is also motivation for this KIP, right? > > > > > > Thanks, > > > John > > > > > > On Tue, May 24, 2022, at 06:48, Sagar wrote: > > >> Hi All, > > >> > > >> I would like to open a voting thread for the following KIP: > > >> > > >> > > > https://cwiki.apache.org/confluence/display/KAFKA/KIP-843%3A+Adding+metricOrElseCreate+method+to+Metrics > > >> > > >> Thanks! > > >> Sagar. > > > > > -- > -- Guozhang >