kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjko...@apache.org
Subject svn commit: r1409296 - in /incubator/kafka/branches/0.8: config/ core/lib/ core/src/main/scala/kafka/ core/src/main/scala/kafka/consumer/ core/src/main/scala/kafka/metrics/ core/src/main/scala/kafka/producer/ perf/src/main/scala/kafka/perf/ project/bui...
Date Wed, 14 Nov 2012 18:57:51 GMT
Author: jjkoshy
Date: Wed Nov 14 18:57:48 2012
New Revision: 1409296

URL: http://svn.apache.org/viewvc?rev=1409296&view=rev
Log:
Remove custom metrics jar and replace with latest from metrics HEAD; patched by Joel Koshy;
reviewed by Jun Rao; KAFKA-585.

Added:
    incubator/kafka/branches/0.8/core/lib/metrics-annotation-3.0.0-c0c8be71.jar   (with props)
    incubator/kafka/branches/0.8/core/lib/metrics-core-3.0.0-c0c8be71.jar   (with props)
Removed:
    incubator/kafka/branches/0.8/core/lib/metrics-annotation-3.0.1.jar
    incubator/kafka/branches/0.8/core/lib/metrics-core-3.0.1.jar
Modified:
    incubator/kafka/branches/0.8/config/server.properties
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/Kafka.scala
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaCSVMetricsReporter.scala
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaMetricsReporter.scala
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/Producer.scala
    incubator/kafka/branches/0.8/perf/src/main/scala/kafka/perf/ProducerPerformance.scala
    incubator/kafka/branches/0.8/project/build/KafkaProject.scala
    incubator/kafka/branches/0.8/system_test/testcase_to_run.json

Modified: incubator/kafka/branches/0.8/config/server.properties
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/config/server.properties?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/config/server.properties (original)
+++ incubator/kafka/branches/0.8/config/server.properties Wed Nov 14 18:57:48 2012
@@ -117,6 +117,7 @@ zk.connectiontimeout.ms=1000000
 # metrics reporter properties
 kafka.metrics.polling.interval.secs=5
 kafka.metrics.reporters=kafka.metrics.KafkaCSVMetricsReporter
-kafka.csv.metrics.dir=kafka_metrics
-kafka.csv.metrics.reporter.enabled=true
+kafka.csv.metrics.dir=/tmp/kafka_metrics
+# Disable csv reporting by default.
+kafka.csv.metrics.reporter.enabled=false
 

Added: incubator/kafka/branches/0.8/core/lib/metrics-annotation-3.0.0-c0c8be71.jar
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/lib/metrics-annotation-3.0.0-c0c8be71.jar?rev=1409296&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/kafka/branches/0.8/core/lib/metrics-annotation-3.0.0-c0c8be71.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/kafka/branches/0.8/core/lib/metrics-core-3.0.0-c0c8be71.jar
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/lib/metrics-core-3.0.0-c0c8be71.jar?rev=1409296&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/kafka/branches/0.8/core/lib/metrics-core-3.0.0-c0c8be71.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/Kafka.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/Kafka.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/Kafka.scala (original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/Kafka.scala Wed Nov 14 18:57:48
2012
@@ -18,7 +18,7 @@
 package kafka
 
 
-import metrics.KafkaCSVMetricsReporter
+import metrics.KafkaMetricsReporter
 import server.{KafkaConfig, KafkaServerStartable, KafkaServer}
 import utils.{Utils, Logging}
 
@@ -33,7 +33,7 @@ object Kafka extends Logging {
     try {
       val props = Utils.loadProps(args(0))
       val serverConfig = new KafkaConfig(props)
-      KafkaCSVMetricsReporter.startCSVMetricReporter(serverConfig.props)
+      KafkaMetricsReporter.startReporters(serverConfig.props)
       val kafkaServerStartble = new KafkaServerStartable(serverConfig)
 
       // attach shutdown handler to catch control-c
@@ -41,7 +41,7 @@ object Kafka extends Logging {
         override def run() = {
           kafkaServerStartble.shutdown
         }
-      });
+      })
 
       kafkaServerStartble.startup
       kafkaServerStartble.awaitShutdown

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
(original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ConsoleConsumer.scala
Wed Nov 14 18:57:48 2012
@@ -26,7 +26,7 @@ import java.io.PrintStream
 import kafka.message._
 import kafka.serializer.StringDecoder
 import kafka.utils._
-import kafka.metrics.KafkaCSVMetricsReporter
+import kafka.metrics.KafkaMetricsReporter
 
 
 /**
@@ -140,7 +140,7 @@ object ConsoleConsumer extends Logging {
         csvReporterProps.put("kafka.csv.metrics.dir", "kafka_metrics")
       csvReporterProps.put("kafka.csv.metrics.reporter.enabled", "true")
       val verifiableProps = new VerifiableProperties(csvReporterProps)
-      KafkaCSVMetricsReporter.startCSVMetricReporter(verifiableProps)
+      KafkaMetricsReporter.startReporters(verifiableProps)
     }
 
     val props = new Properties()

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
(original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala
Wed Nov 14 18:57:48 2012
@@ -117,7 +117,7 @@ private[kafka] class ZookeeperConsumerCo
       config.autoCommitIntervalMs, false)
   }
 
-  KafkaCSVMetricsReporter.startCSVMetricReporter(config.props)
+  KafkaMetricsReporter.startReporters(config.props)
 
   def this(config: ConsumerConfig) = this(config, true)
 

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaCSVMetricsReporter.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaCSVMetricsReporter.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaCSVMetricsReporter.scala
(original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaCSVMetricsReporter.scala
Wed Nov 14 18:57:48 2012
@@ -30,26 +30,6 @@ import kafka.utils.{Utils, VerifiablePro
 
 private trait KafkaCSVMetricsReporterMBean extends KafkaMetricsReporterMBean
 
-object KafkaCSVMetricsReporter {
-  val CSVReporterStarted: AtomicBoolean = new AtomicBoolean(false)
-
-  def startCSVMetricReporter (verifiableProps: VerifiableProperties) {
-    CSVReporterStarted synchronized {
-      if (CSVReporterStarted.get() == false) {
-        val metricsConfig = new KafkaMetricsConfig(verifiableProps)
-        if(metricsConfig.reporters.size > 0) {
-          metricsConfig.reporters.foreach(reporterType => {
-            val reporter = Utils.createObject[KafkaMetricsReporter](reporterType)
-            reporter.init(verifiableProps)
-            if (reporter.isInstanceOf[KafkaMetricsReporterMBean])
-              Utils.registerMBean(reporter, reporter.asInstanceOf[KafkaMetricsReporterMBean].getMBeanName)
-          })
-          CSVReporterStarted.set(true)
-        }
-      }
-    }
-  }
-}
 
 private class KafkaCSVMetricsReporter extends KafkaMetricsReporter
                               with KafkaCSVMetricsReporterMBean
@@ -69,8 +49,8 @@ private class KafkaCSVMetricsReporter ex
       if (!initialized) {
         val metricsConfig = new KafkaMetricsConfig(props)
         csvDir = new File(props.getString("kafka.csv.metrics.dir", "kafka_metrics"))
-        if (!csvDir.exists())
-          csvDir.mkdirs()
+        Utils.rm(csvDir)
+        csvDir.mkdirs()
         underlying = new CsvReporter(Metrics.defaultRegistry(), csvDir)
         if (props.getBoolean("kafka.csv.metrics.reporter.enabled", default = false)) {
           initialized = true

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaMetricsReporter.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaMetricsReporter.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaMetricsReporter.scala
(original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/metrics/KafkaMetricsReporter.scala
Wed Nov 14 18:57:48 2012
@@ -20,7 +20,9 @@
 
 package kafka.metrics
 
-import kafka.utils.VerifiableProperties
+import kafka.utils.{Utils, VerifiableProperties}
+import java.util.concurrent.atomic.AtomicBoolean
+
 
 /**
  * Base trait for reporter MBeans. If a client wants to expose these JMX
@@ -45,3 +47,24 @@ trait KafkaMetricsReporter {
   def init(props: VerifiableProperties)
 }
 
+object KafkaMetricsReporter {
+  val ReporterStarted: AtomicBoolean = new AtomicBoolean(false)
+
+  def startReporters (verifiableProps: VerifiableProperties) {
+    ReporterStarted synchronized {
+      if (ReporterStarted.get() == false) {
+        val metricsConfig = new KafkaMetricsConfig(verifiableProps)
+        if(metricsConfig.reporters.size > 0) {
+          metricsConfig.reporters.foreach(reporterType => {
+            val reporter = Utils.createObject[KafkaMetricsReporter](reporterType)
+            reporter.init(verifiableProps)
+            if (reporter.isInstanceOf[KafkaMetricsReporterMBean])
+              Utils.registerMBean(reporter, reporter.asInstanceOf[KafkaMetricsReporterMBean].getMBeanName)
+          })
+          ReporterStarted.set(true)
+        }
+      }
+    }
+  }
+}
+

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/Producer.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/Producer.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/Producer.scala (original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/Producer.scala Wed Nov
14 18:57:48 2012
@@ -49,7 +49,7 @@ extends Logging {
     case _ => throw new InvalidConfigException("Valid values for producer.type are sync/async")
   }
 
-  KafkaCSVMetricsReporter.startCSVMetricReporter(config.props)
+  KafkaMetricsReporter.startReporters(config.props)
 
   def this(config: ProducerConfig) =
     this(config,

Modified: incubator/kafka/branches/0.8/perf/src/main/scala/kafka/perf/ProducerPerformance.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/perf/src/main/scala/kafka/perf/ProducerPerformance.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/perf/src/main/scala/kafka/perf/ProducerPerformance.scala
(original)
+++ incubator/kafka/branches/0.8/perf/src/main/scala/kafka/perf/ProducerPerformance.scala
Wed Nov 14 18:57:48 2012
@@ -26,7 +26,7 @@ import java.text.SimpleDateFormat
 import java.util._
 import collection.immutable.List
 import kafka.utils.{VerifiableProperties, Logging}
-import kafka.metrics.KafkaCSVMetricsReporter
+import kafka.metrics.KafkaMetricsReporter
 
 
 /**
@@ -175,7 +175,7 @@ object ProducerPerformance extends Loggi
         props.put("kafka.csv.metrics.dir", "kafka_metrics")
       props.put("kafka.csv.metrics.reporter.enabled", "true")
       val verifiableProps = new VerifiableProperties(props)
-      KafkaCSVMetricsReporter.startCSVMetricReporter(verifiableProps)
+      KafkaMetricsReporter.startReporters(verifiableProps)
     }
 
     val messageSendGapMs = options.valueOf(messageSendGapMsOpt).intValue()

Modified: incubator/kafka/branches/0.8/project/build/KafkaProject.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/project/build/KafkaProject.scala?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/project/build/KafkaProject.scala (original)
+++ incubator/kafka/branches/0.8/project/build/KafkaProject.scala Wed Nov 14 18:57:48 2012
@@ -71,13 +71,13 @@ class KafkaProject(info: ProjectInfo) ex
         <dependency>
           <groupId>com.yammer.metrics</groupId>
           <artifactId>metrics-core</artifactId>
-          <version>3.0.1</version>
+          <version>3.0.0-c0c8be71</version>
           <scope>compile</scope>
         </dependency>
         <dependency>
           <groupId>com.yammer.metrics</groupId>
           <artifactId>metrics-annotations</artifactId>
-          <version>3.0.1</version>
+          <version>3.0.0-c0c8be71</version>
           <scope>compile</scope>
         </dependency>
       </dependencies>

Modified: incubator/kafka/branches/0.8/system_test/testcase_to_run.json
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/system_test/testcase_to_run.json?rev=1409296&r1=1409295&r2=1409296&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/system_test/testcase_to_run.json (original)
+++ incubator/kafka/branches/0.8/system_test/testcase_to_run.json Wed Nov 14 18:57:48 2012
@@ -1,6 +1,5 @@
 {
-    "ReplicaBasicTest"  : [
-        "testcase_0001",
+    "ReplicaBasicTest"   : [
         "testcase_1"
     ]
 }



Mime
View raw message