Charles-Eddy created KAFKA-19753:
------------------------------------

             Summary: Metrics from FetchMetricsManager containing a topic tag 
are duplicated
                 Key: KAFKA-19753
                 URL: https://issues.apache.org/jira/browse/KAFKA-19753
             Project: Kafka
          Issue Type: Bug
          Components: consumer, metrics
    Affects Versions: 4.1.0
            Reporter: Charles-Eddy


Hello,

Since Kafka 4.1.0, we're experiencing an issue with Kafka Streams metrics for 
topics containing dots in their names. (I think the problem is also for simple 
usage of consumers not only kstream)

In FetchMetricsManager, methods like {{recordRecordsFetched()}} now create 
duplicate sensors for the same topic if they contain dot in their name: 
{code:java}
void recordRecordsFetched(String topic, int records) { 


 String name = topicRecordsFetchedMetricName(topic); 


 maybeRecordDeprecatedRecordsFetched(name, topic, records); <-- here we create 
another sensor if the topic name contains dot




 Sensor recordsFetched = new SensorBuilder(metrics, name, () -> Map.of("topic", 
topic)) 


 .withAvg(metricsRegistry.topicRecordsPerRequestAvg) 


 .withMeter(metricsRegistry.topicRecordsConsumedRate, 
metricsRegistry.topicRecordsConsumedTotal) 


 .build(); 


 recordsFetched.record(records); 


 }  {code}
It currently record two sensors, one with my original topic name, one time with 
a topic name with dots replaced by underscore. 

While we can work around this by reversing the transformation (replacing 
underscores back to dots in Micrometer filters), this does not feel like a 
long-term solution for us.

Could a configuration option be added to disable the deprecated 
underscore-replaced metrics?

Thanks in advance



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to