You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "divijvaidya (via GitHub)" <gi...@apache.org> on 2023/06/22 12:15:31 UTC

[GitHub] [kafka] divijvaidya commented on a diff in pull request #13900: MINOR: some minor cleanups for process startup

divijvaidya commented on code in PR #13900:
URL: https://github.com/apache/kafka/pull/13900#discussion_r1238424518


##########
core/src/main/scala/kafka/metrics/LinuxIoMetricsCollector.scala:
##########
@@ -94,6 +96,22 @@ class LinuxIoMetricsCollector(procRoot: String, val time: Time, val logger: Logg
       false
     }
   }
+
+  def maybeRegisterMetrics(registry: MetricsRegistry): Unit = {

Review Comment:
   we should have a similar method for unregister which would be called on shutdown



##########
core/src/main/scala/kafka/metrics/LinuxIoMetricsCollector.scala:
##########
@@ -94,6 +96,22 @@ class LinuxIoMetricsCollector(procRoot: String, val time: Time, val logger: Logg
       false
     }
   }
+
+  def maybeRegisterMetrics(registry: MetricsRegistry): Unit = {
+    def registerGauge(name: String, gauge: Gauge[Long]): Unit = {
+      val metricName = KafkaYammerMetrics.getMetricName(
+        "kafka.server",

Review Comment:
   please correct me if I am wrong here, this is a change in metric name. Earlier when we were using `metricsGroup` in `ControllerServer` the name of the metric would have included ControllerServer but now it includes KafkaServer.
   Isn't this a breaking change?



##########
core/src/main/scala/kafka/server/BrokerServer.scala:
##########
@@ -75,6 +76,8 @@ class BrokerServer(
   // Get raftManager from SharedServer. It will be initialized during startup.
   def raftManager: KafkaRaftManager[ApiMessageAndVersion] = sharedServer.raftManager
 
+  Server.maybeRegisterLinuxMetrics(config, time, logger.underlying)

Review Comment:
   This is a new change. Earlier brokers didn't have this metric. Please update the PR title and description to reflect this or start a new PR for this change.



-- 
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-unsubscribe@kafka.apache.org

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