[ 
https://issues.apache.org/jira/browse/KAFKA-19753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18053619#comment-18053619
 ] 

Charles-Eddy commented on KAFKA-19753:
--------------------------------------

Hey,
Any update on this?


And about your last question (sorry, I totally missed it): yeah, I think this 
could apply to any deprecated metric that behaves the same way, not just the 
consumer component.
Not sure if it’s worth going as far as having one config per component though. 
I’d just go with whatever’s simplest on your side.
Also, I don’t have a strong opinion on whether the flag should stop the 
deprecated metric or the new one. My gut says “stop the deprecated one”, but 
honestly either works for me as long as we only end up reporting one metric in 
the end.

> 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: clients, consumer, metrics
>    Affects Versions: 4.1.0
>            Reporter: Charles-Eddy
>            Priority: Minor
>         Attachments: Screenshot 2025-10-03 at 09.44.11.png, Screenshot 
> 2025-10-03 at 09.46.42.png
>
>
> 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 in our case 
> (replacing underscores back to dots in Micrometer filters) or by removing 
> this specific list of metrics, this does not feel like a long-term solution 
> for us.-
> Currently using spring-boot and micrometer, it's really hard to remove one of 
> those duplicated metrics. 
> Could a configuration option be added to disable one of the two sensor to 
> avoid having duplicated metrics?
> Thanks in advance



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

Reply via email to