You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2012/10/30 02:36:44 UTC
svn commit: r1403601 -
/incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala
Author: junrao
Date: Tue Oct 30 01:36:44 2012
New Revision: 1403601
URL: http://svn.apache.org/viewvc?rev=1403601&view=rev
Log:
Register metrics beans at kafka server startup; patched by Swapnil Ghike; reviewed by Jun Rao; KAFKA-592
Modified:
incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala
Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala?rev=1403601&r1=1403600&r2=1403601&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala (original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/server/KafkaServer.scala Tue Oct 30 01:36:44 2012
@@ -24,7 +24,7 @@ import kafka.utils._
import java.util.concurrent._
import atomic.AtomicBoolean
import org.I0Itec.zkclient.ZkClient
-import kafka.controller.KafkaController
+import kafka.controller.{ControllerStat, KafkaController}
/**
* Represents the lifecycle of a single Kafka broker. Handles all functionality required
@@ -99,9 +99,19 @@ class KafkaServer(val config: KafkaConfi
replicaManager.startup()
// start the controller
kafkaController.startup()
+ // register metrics beans
+ registerStats()
info("started")
}
+ /**
+ * Forces some dynamic jmx beans to be registered on server startup.
+ */
+ private def registerStats() {
+ BrokerTopicStat.getBrokerAllTopicStat()
+ ControllerStat.offlinePartitionRate
+ ControllerStat.uncleanLeaderElectionRate
+ }
/**
* Shutdown API for shutting down a single instance of the Kafka server.