apovzner commented on a change in pull request #9317:
URL: https://github.com/apache/kafka/pull/9317#discussion_r494053882



##########
File path: core/src/main/scala/kafka/network/SocketServer.scala
##########
@@ -1292,6 +1292,12 @@ class ConnectionQuotas(config: KafkaConfig, time: Time, 
metrics: Metrics) extend
     counts.synchronized {
       val startThrottleTimeMs = time.milliseconds
       val throttleTimeMs = 
math.max(recordConnectionAndGetThrottleTimeMs(listenerName, 
startThrottleTimeMs), 0)
+      if (throttleTimeMs > 0) {
+        // record throttle time due to hitting connection rate limit
+        // connection could be throttled longer if the limit of the number of 
active connections is reached as well
+        maxConnectionsPerListener.get(listenerName)
+          
.foreach(_.connectionRateThrottleSensor.record(throttleTimeMs.toDouble, 
startThrottleTimeMs))

Review comment:
       That code seemed readable to me, but perhaps looking up 
`ListenerConnectionQuota` is better. I made a change to lookup once, please 
take a look.




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

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


Reply via email to