zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1622828 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
Date Sat, 06 Sep 2014 05:27:02 GMT
Author: sijie
Date: Sat Sep  6 05:27:02 2014
New Revision: 1622828

URL: http://svn.apache.org/r1622828
Log:
BOOKKEEPER-779: jmx reporter for codahale metrics provider (ivank via sijie)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1622828&r1=1622827&r2=1622828&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Sat Sep  6 05:27:02 2014
@@ -224,6 +224,10 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-768: fix typo 'seconds' to milliseconds in benchmark output (jialin via
sijie)
 
+      bookkeeper-stats-providers:
+
+        BOOKKEEPER-779: jmx reporter for codahale metrics provider (ivank via sijie)
+
       hedwig-server:
 
         BOOKKEEPER-601: readahead cache size isn't updated correctly (sijie via fpj)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java?rev=1622828&r1=1622827&r2=1622828&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
Sat Sep  6 05:27:02 2014
@@ -23,6 +23,7 @@ import com.codahale.metrics.MetricFilter
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.ScheduledReporter;
 import com.codahale.metrics.Slf4jReporter;
+import com.codahale.metrics.JmxReporter;
 import com.google.common.base.Strings;
 import com.google.common.net.HostAndPort;
 import static com.codahale.metrics.MetricRegistry.name;
@@ -51,6 +52,7 @@ public class CodahaleMetricsProvider imp
 
     MetricRegistry metrics = null;
     List<ScheduledReporter> reporters = new ArrayList<ScheduledReporter>();
+    JmxReporter jmx = null;
 
     synchronized void initIfNecessary() {
         if (metrics == null) {
@@ -73,6 +75,7 @@ public class CodahaleMetricsProvider imp
         String graphiteHost = conf.getString("codahaleStatsGraphiteEndpoint");
         String csvDir = conf.getString("codahaleStatsCSVEndpoint");
         String slf4jCat = conf.getString("codahaleStatsSlf4jEndpoint");
+        String jmxDomain = conf.getString("codahaleStatsJmxEndpoint");
 
         if (!Strings.isNullOrEmpty(graphiteHost)) {
             LOG.info("Configuring stats with graphite");
@@ -110,6 +113,16 @@ public class CodahaleMetricsProvider imp
                           .convertDurationsTo(TimeUnit.MILLISECONDS)
                           .build());
         }
+        if (!Strings.isNullOrEmpty(jmxDomain)) {
+            LOG.info("Configuring stats with jmx");
+            jmx = JmxReporter.forRegistry(metrics)
+                .inDomain(jmxDomain)
+                .convertRatesTo(TimeUnit.SECONDS)
+                .convertDurationsTo(TimeUnit.MILLISECONDS)
+                .build();
+            jmx.start();
+        }
+
         for (ScheduledReporter r : reporters) {
             r.start(metricsOutputFrequency, TimeUnit.SECONDS);
         }
@@ -121,6 +134,9 @@ public class CodahaleMetricsProvider imp
             r.report();
             r.stop();
         }
+        if (jmx != null) {
+            jmx.stop();
+        }
     }
 
     @Override



Mime
View raw message