This is an automated email from the ASF dual-hosted git repository.

viktorsomogyi pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 88b48794eaf KAFKA-19193: trace-log rack-specific load stats in 
rack-aware mode (#22434)
88b48794eaf is described below

commit 88b48794eafd32cfceeb9e15e4b28b5c82cb0ea1
Author: Ivan Yurchenko <[email protected]>
AuthorDate: Tue Jun 23 17:03:27 2026 +0200

    KAFKA-19193: trace-log rack-specific load stats in rack-aware mode (#22434)
    
    As a follow-up to comments in https://github.com/apache/kafka/pull/19850
    
    Reviewers: Viktor Somogyi-Vass <[email protected]>
---
 .../clients/producer/internals/BuiltInPartitioner.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/clients/src/main/java/org/apache/kafka/clients/producer/internals/BuiltInPartitioner.java
 
b/clients/src/main/java/org/apache/kafka/clients/producer/internals/BuiltInPartitioner.java
index ba58840a9c6..21d715af662 100644
--- 
a/clients/src/main/java/org/apache/kafka/clients/producer/internals/BuiltInPartitioner.java
+++ 
b/clients/src/main/java/org/apache/kafka/clients/producer/internals/BuiltInPartitioner.java
@@ -334,8 +334,19 @@ public class BuiltInPartitioner {
         // Invert and fold the queue size, so that they become separator 
values in the CFT.
         invertAndFoldQueueSizeArray(queueSizes, maxSizePlus1, length);
 
-        log.trace("Partition load stats for topic {}: CFT={}, IDs={}, 
length={}",
-                topic, queueSizes, partitionIds, length);
+        if (log.isTraceEnabled()) {
+            if (rackAware) {
+                assert partitionLoadStatsInThisRack != null;
+                log.trace(
+                    "Partition load stats for topic {}: CFT={}, IDs={}, 
length={}; in producer rack: CFT={}, IDs={}, length={}",
+                    topic,
+                    queueSizes, partitionIds, length,
+                    partitionLoadStatsInThisRack.cumulativeFrequencyTable, 
partitionLoadStatsInThisRack.partitionIds, partitionLoadStatsInThisRack.length);
+            } else {
+                log.trace("Partition load stats for topic {}: CFT={}, IDs={}, 
length={}",
+                    topic, queueSizes, partitionIds, length);
+            }
+        }
         partitionLoadStatsHolder = new PartitionLoadStatsHolder(
             new PartitionLoadStats(queueSizes, partitionIds, length),
             partitionLoadStatsInThisRack

Reply via email to