soarez commented on code in PR #14942:
URL: https://github.com/apache/kafka/pull/14942#discussion_r1423140834


##########
server/src/main/java/org/apache/kafka/server/AssignmentsManager.java:
##########
@@ -93,10 +100,24 @@ public AssignmentsManager(Time time,
                 "broker-" + brokerId + "-directory-assignments-manager-",
                 new ShutdownEvent());
         channelManager.start();
+        
this.metricsGroup.newGauge(QUEUE_REPLICA_TO_DIR_ASSIGNMENTS_METRIC_NAME, new 
Gauge<Integer>() {
+            @Override
+            public Integer value() {
+                return getMapSize(inflight) + getMapSize(pending);

Review Comment:
   The map references are copied into `getMapSize` which avoids a 
check-then-act NPE race.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to