d4v1de commented on code in PR #20397:
URL: https://github.com/apache/kafka/pull/20397#discussion_r2496436811


##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -669,6 +671,20 @@ class KafkaApis(val requestChannel: RequestChannel,
             if (topicResponse.topic != null) {
               val tp = new TopicIdPartition(topicResponse.topicId, new 
TopicPartition(topicResponse.topic, data.partitionIndex))
               brokerTopicStats.updateBytesOut(tp.topic, 
fetchRequest.isFromFollower, reassigningPartitions.contains(tp), 
FetchResponse.recordsSize(data))
+              // KIP-977: Partition metrics for client fetches
+              if (!fetchRequest.isFromFollower) {

Review Comment:
   What do you think of moving this logic to a new method in `brokerTopicStats`?
   Example:
   ```scala
   val size = FetchResponse.recordsSize(data)
   brokerTopicStats.updateBytesOut(tp.topic, fetchRequest.isFromFollower, 
reassigningPartitions.contains(tp), size)
   brokerTopicStats.updateBytesOutPerPartition(tp.topic, tp.partition, 
fetchRequest.isFromFollower, size)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to