junrao commented on code in PR #14767:
URL: https://github.com/apache/kafka/pull/14767#discussion_r1411280008


##########
core/src/main/scala/kafka/server/BrokerServer.scala:
##########
@@ -235,14 +235,15 @@ class BrokerServer(
       )
       clientToControllerChannelManager.start()
       forwardingManager = new 
ForwardingManagerImpl(clientToControllerChannelManager)
-
+      clientMetricsManager = new 
ClientMetricsManager(clientMetricsReceiverPlugin, 
config.clientTelemetryMaxBytes, time)
 
       val apiVersionManager = ApiVersionManager(
         ListenerType.BROKER,
         config,
         Some(forwardingManager),
         brokerFeatures,
-        metadataCache
+        metadataCache,
+        Some(clientMetricsManager)

Review Comment:
   We need to be a bit careful about synchronization. 
`ClientMetricsReceiverPlugin.receivers` is set in the main thread later through 
`config.dynamicConfig.addReconfigurables(this)`, but is read in either the 
network or the request handler thread. We need to add memory barrier to ensure 
visibility across threads.



##########
core/src/main/scala/kafka/server/ApiVersionManager.scala:
##########
@@ -130,7 +133,8 @@ class DefaultApiVersionManager(
   brokerFeatures: BrokerFeatures,
   metadataCache: MetadataCache,
   val enableUnstableLastVersion: Boolean,
-  val zkMigrationEnabled: Boolean = false
+  val zkMigrationEnabled: Boolean = false,
+  val clientMetricsManager: Option[ClientMetricsManager] = None

Review Comment:
   Could we add the new param to javadoc?



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