MahsaSeifikar commented on code in PR #20422:
URL: https://github.com/apache/kafka/pull/20422#discussion_r2310507716


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -842,6 +846,7 @@ public void handleException(Throwable exception) {
 
         @Override
         public void complete(Throwable exception) {
+            controllerMetrics.updateIdleEndTime();

Review Comment:
   We call `updateIdleStartTime` in both `handleEventEnd` and 
`handleEventException`, not `updateIdleEndTime`.
   
   We measure controller idleness in two main scenarios:
   - Waiting for a new event which measures the time the controller spends 
waiting between events or for new event. The idle period starts when a previous 
event finishes or fails and it ends right before a new event starts, which is 
when we call `updateIdleEndTime` inside `updateEventStartMetricsAndGetTime`.
   
   - Waiting for a Raft layer which measures the asynchronous time spent 
waiting for a response from Raft layer. The idle time starts when we add a 
`ControllerWriteEvent` to the deferred queue, that's why we call 
`updateIdleStartTime` and ends when this event is completed.
   
   Note: Although controller isn't truly idle while waiting for KRaft, we 
include this asynchronous wait in the total controller event processing time 
metrics. As a result, when looking at the total processing time, it is not 
possible to distinguish between time the controller spent actively working and 
time it spent waiting for the Raft layer



-- 
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