[ https://issues.apache.org/jira/browse/KAFKA-14081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579022#comment-17579022 ]
Gian Luca edited comment on KAFKA-14081 at 8/12/22 3:29 PM: ------------------------------------------------------------ Hi Rens and Bruno, thanks for the explanation, now I understand. If I had looked at the JmxReporter before, then the function of {{metricChange()}} would have been clear. I was under the impression that a reporter can stay up to date about metrics and their values by simply listening to what is passed by {{{}metricChange(){}}}, but I understand that it's slightly more complicated: a reporter uses {{metricChange()}} only to discover metrics in the form of KafkaMetric instances. It's then the reporter's responsibility to poll a KafkaMetric object to get newer values. I'll see if I can think of a different wording for the Javadoc of the method, for now thanks for the help! was (Author: JIRAUSER293007): Hi Rens and Bruno, thanks for the explanation, now I understand. If I had looked at the JmxReporter before, then the function of {{metricChange()}} would have been clear. I was under the impression that a reporter can stay up to date about metrics and their values by simply listening to what is passed by {{{}metricChange(){}}}, but I understand that it's slightly more complicated: a reporter uses {{metricChange()}} only to discover metrics in the form of KafkaMetric instances. It's then the reporter's responsibility to poll a KafkaMetric object to get newer values. I'll if I can think of a different wording for the Javadoc of the method, for now thanks for the help! > Cannot get my MetricsReporter implementation to receive meaningful metrics > -------------------------------------------------------------------------- > > Key: KAFKA-14081 > URL: https://issues.apache.org/jira/browse/KAFKA-14081 > Project: Kafka > Issue Type: Bug > Components: clients > Affects Versions: 3.3.0 > Reporter: Gian Luca > Priority: Minor > > I want to extract metrics from KafkaProducer to export them to our company > monitoring solution. At first I went for implementing {{MetricsReporter}} and > registering my implementation through the "metric.reporters" config property. > The class is correctly registered as it receives metric updates through > {{metricChange()}} while KafkaProducer is being used. The problem is that all > the metric values are stuck at zero (NaN in older versions of Kafka), even > the most trivial (e.g. 'record-send-total'). > If instead of using a report I simply poll the {{metrics()}} method of the > KafkaProducer, then I see meaningful values: counters increasing over time, > etc. -- This message was sent by Atlassian Jira (v8.20.10#820010)