cmccabe commented on code in PR #16904:
URL: https://github.com/apache/kafka/pull/16904#discussion_r1731543334


##########
core/src/main/scala/kafka/server/ForwardingManager.scala:
##########
@@ -104,21 +112,30 @@ object ForwardingManager {
 }
 
 class ForwardingManagerImpl(
-  channelManager: NodeToControllerChannelManager
-) extends ForwardingManager with Logging {
+  channelManager: NodeToControllerChannelManager,
+  metrics: Metrics
+) extends ForwardingManager with AutoCloseable with Logging {
+
+  val forwardingManagerMetrics: ForwardingManagerMetrics = 
ForwardingManagerMetrics(metrics)
 
   override def forwardRequest(
     requestContext: RequestContext,
     requestBufferCopy: ByteBuffer,
+    requestCreationNs: Long,
     requestBody: AbstractRequest,
     requestToString: () => String,
     responseCallback: Option[AbstractResponse] => Unit
   ): Unit = {
     val envelopeRequest = 
ForwardingManager.buildEnvelopeRequest(requestContext, requestBufferCopy)
+    val requestCreationTimeMs = 
TimeUnit.NANOSECONDS.toMillis(requestCreationNs)
 
     class ForwardingResponseHandler extends ControllerRequestCompletionHandler 
{
       override def onComplete(clientResponse: ClientResponse): Unit = {
 
+        forwardingManagerMetrics.queueLength.getAndDecrement()

Review Comment:
   This doesn't seem to be decremented on timeout. Also, we need to decide what 
to do about the other metrics on timeout. Probably just record how long we 
waited.



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