cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject [2/2] git commit: update metrics-core to 3.0.1 patch by dbrosius reviewed by jbellis for cassandra-5838
Date Sat, 10 Aug 2013 14:35:03 GMT
update metrics-core to 3.0.1
patch by dbrosius reviewed by jbellis for cassandra-5838


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c27a1619
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c27a1619
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c27a1619

Branch: refs/heads/trunk
Commit: c27a161920a2227cd04f8338a75732920694b1db
Parents: 9bc8fa2
Author: Dave Brosius <dbrosius@apache.org>
Authored: Sat Aug 10 10:06:58 2013 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Sat Aug 10 10:34:07 2013 -0400

----------------------------------------------------------------------
 build.xml                                       |   4 +-
 lib/metrics-core-2.0.3.jar                      | Bin 80800 -> 0 bytes
 lib/metrics-core-3.0.1.jar                      | Bin 0 -> 85449 bytes
 .../JMXEnabledThreadPoolExecutor.java           |   4 +-
 .../apache/cassandra/db/ColumnFamilyStore.java  |  55 +++----
 .../cassandra/db/commitlog/CommitLog.java       |   6 +-
 .../db/compaction/CompactionManager.java        |   8 +-
 .../locator/DynamicEndpointSnitch.java          |  19 ++-
 .../apache/cassandra/metrics/CacheMetrics.java  |  42 +++---
 .../metrics/CassandraMetricRegistry.java        |  46 ++++++
 .../cassandra/metrics/ClientRequestMetrics.java |  24 ++--
 .../cassandra/metrics/ColumnFamilyMetrics.java  | 142 ++++++++++---------
 .../cassandra/metrics/CommitLogMetrics.java     |  17 ++-
 .../cassandra/metrics/CompactionMetrics.java    |  22 ++-
 .../cassandra/metrics/ConnectionMetrics.java    |  48 +++----
 .../metrics/DroppedMessageMetrics.java          |  11 +-
 .../cassandra/metrics/HintedHandoffMetrics.java |  13 +-
 .../cassandra/metrics/LatencyMetrics.java       |  23 ++-
 .../cassandra/metrics/MetricNameFactory.java    |   4 +-
 .../cassandra/metrics/ReadRepairMetrics.java    |  14 +-
 .../cassandra/metrics/StorageMetrics.java       |   7 +-
 .../cassandra/metrics/StreamingMetrics.java     |  15 +-
 .../cassandra/metrics/ThreadPoolMetrics.java    |  34 ++---
 .../apache/cassandra/net/MessagingService.java  |   6 +-
 .../net/OutboundTcpConnectionPool.java          |   2 +-
 .../cassandra/scheduler/WeightedQueue.java      |   4 +-
 .../apache/cassandra/service/CacheService.java  |  16 +--
 .../apache/cassandra/service/StorageProxy.java  |  18 +--
 .../org/apache/cassandra/db/KeyspaceTest.java   |  16 +--
 .../org/apache/cassandra/stress/Session.java    |  33 +++--
 .../apache/cassandra/stress/StressAction.java   |   2 +-
 .../cassandra/stress/StressStatistics.java      |   2 +-
 .../stress/operations/CounterAdder.java         |   4 +-
 .../stress/operations/CounterGetter.java        |  23 +--
 .../stress/operations/CqlCounterAdder.java      |   4 +-
 .../stress/operations/CqlCounterGetter.java     |   4 +-
 .../operations/CqlIndexedRangeSlicer.java       |   4 +-
 .../stress/operations/CqlInserter.java          |   4 +-
 .../stress/operations/CqlRangeSlicer.java       |   4 +-
 .../cassandra/stress/operations/CqlReader.java  |   4 +-
 .../stress/operations/IndexedRangeSlicer.java   |   4 +-
 .../cassandra/stress/operations/Inserter.java   |   4 +-
 .../stress/operations/MultiGetter.java          |   6 +-
 .../stress/operations/RangeSlicer.java          |   6 +-
 .../cassandra/stress/operations/Reader.java     |   6 +-
 45 files changed, 397 insertions(+), 337 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index a72adf4..17b3705 100644
--- a/build.xml
+++ b/build.xml
@@ -371,7 +371,7 @@
           <dependency groupId="log4j" artifactId="log4j" version="1.2.16" />
           <dependency groupId="org.apache.cassandra" artifactId="cassandra-all" version="${version}" />
           <dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift" version="${version}" />
-          <dependency groupId="com.yammer.metrics" artifactId="metrics-core" version="2.2.0" />
+          <dependency groupId="com.codahale.metrics" artifactId="metrics-core" version="3.0.1" />
           <dependency groupId="edu.stanford.ppl" artifactId="snaptree" version="0.1" />
           <dependency groupId="org.mindrot" artifactId="jbcrypt" version="0.3m" />
           <dependency groupId="io.netty" artifactId="netty" version="3.5.9.Final" />
@@ -450,7 +450,7 @@
         <dependency groupId="org.yaml" artifactId="snakeyaml"/>
         <dependency groupId="edu.stanford.ppl" artifactId="snaptree"/>
         <dependency groupId="org.mindrot" artifactId="jbcrypt"/>
-        <dependency groupId="com.yammer.metrics" artifactId="metrics-core"/>
+      	<dependency groupId="com.codahale.metrics" artifactId="metrics-core"/>
         <dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.0"/>
 
         <dependency groupId="log4j" artifactId="log4j"/>

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/lib/metrics-core-2.0.3.jar
----------------------------------------------------------------------
diff --git a/lib/metrics-core-2.0.3.jar b/lib/metrics-core-2.0.3.jar
deleted file mode 100644
index 729e6e8..0000000
Binary files a/lib/metrics-core-2.0.3.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/lib/metrics-core-3.0.1.jar
----------------------------------------------------------------------
diff --git a/lib/metrics-core-3.0.1.jar b/lib/metrics-core-3.0.1.jar
new file mode 100644
index 0000000..9b50dad
Binary files /dev/null and b/lib/metrics-core-3.0.1.jar differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java b/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java
index de448b5..db75e8f 100644
--- a/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java
+++ b/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java
@@ -151,12 +151,12 @@ public class JMXEnabledThreadPoolExecutor extends DebuggableThreadPoolExecutor i
 
     public int getTotalBlockedTasks()
     {
-        return (int) metrics.totalBlocked.count();
+        return (int) metrics.totalBlocked.getCount();
     }
 
     public int getCurrentlyBlockedTasks()
     {
-        return (int) metrics.currentBlocked.count();
+        return (int) metrics.currentBlocked.getCount();
     }
 
     public int getCoreThreads()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 7b11672..ec12736 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -26,6 +26,7 @@ import java.util.concurrent.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.regex.Pattern;
+
 import javax.management.*;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -33,9 +34,9 @@ import com.google.common.base.Function;
 import com.google.common.collect.*;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.Uninterruptibles;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.cassandra.cache.IRowCacheEntry;
 import org.apache.cassandra.cache.RowCacheKey;
 import org.apache.cassandra.cache.RowCacheSentinel;
@@ -66,6 +67,7 @@ import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.io.sstable.*;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.metrics.CassandraMetricRegistry;
 import org.apache.cassandra.metrics.ColumnFamilyMetrics;
 import org.apache.cassandra.service.CacheService;
 import org.apache.cassandra.service.StorageService;
@@ -303,7 +305,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
                 {
                     case PERCENTILE:
                         // get percentile in nanos
-                        assert metric.readLatency.latency.durationUnit() == TimeUnit.MICROSECONDS;
                         sampleLatency = (long) (metric.readLatency.latency.getSnapshot().getValue(retryPolicy.value) * 1000d);
                         break;
                     case CUSTOM:
@@ -359,17 +360,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getMinRowSize()
     {
-        return metric.minRowSize.value();
+        return metric.minRowSize.getValue();
     }
 
     public long getMaxRowSize()
     {
-        return metric.maxRowSize.value();
+        return metric.maxRowSize.getValue();
     }
 
     public long getMeanRowSize()
     {
-        return metric.meanRowSize.value();
+        return metric.meanRowSize.getValue();
     }
 
     public int getMeanColumns()
@@ -737,8 +738,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
                 }
             }
 
-            if (metric.memtableSwitchCount.count() == Long.MAX_VALUE)
-                metric.memtableSwitchCount.clear();
+            if (metric.memtableSwitchCount.getCount() == Long.MAX_VALUE)
+                metric.resetMemTableSwitchCount();
             metric.memtableSwitchCount.inc();
 
             // when all the memtables have been written, including for indexes, mark the flush in the commitlog header.
@@ -837,7 +838,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         while (true)
         {
             long last = liveRatioComputedAt.get();
-            long operations = metric.writeLatency.latency.count();
+            long operations = metric.writeLatency.latency.getCount();
             if (operations < 2 * last)
                 break;
             if (liveRatioComputedAt.compareAndSet(last, operations))
@@ -1074,12 +1075,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getMemtableColumnsCount()
     {
-        return metric.memtableColumnsCount.value();
+        return metric.memtableColumnsCount.getValue();
     }
 
     public long getMemtableDataSize()
     {
-        return metric.memtableDataSize.value();
+        return metric.memtableDataSize.getValue();
     }
 
     public long getTotalMemtableLiveSize()
@@ -1089,7 +1090,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public int getMemtableSwitchCount()
     {
-        return (int) metric.memtableSwitchCount.count();
+        return (int) metric.memtableSwitchCount.getCount();
     }
 
     private Memtable getMemtableThreadSafe()
@@ -1127,7 +1128,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getReadCount()
     {
-        return metric.readLatency.latency.count();
+        return metric.readLatency.latency.getCount();
     }
 
     public double getRecentReadLatencyMicros()
@@ -1147,22 +1148,22 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getTotalReadLatencyMicros()
     {
-        return metric.readLatency.totalLatency.count();
+        return metric.readLatency.totalLatency.getCount();
     }
 
     public int getPendingTasks()
     {
-        return metric.pendingTasks.value();
+        return metric.pendingTasks.getValue();
     }
 
     public long getWriteCount()
     {
-        return metric.writeLatency.latency.count();
+        return metric.writeLatency.latency.getCount();
     }
 
     public long getTotalWriteLatencyMicros()
     {
-        return metric.writeLatency.totalLatency.count();
+        return metric.writeLatency.totalLatency.getCount();
     }
 
     public double getRecentWriteLatencyMicros()
@@ -1766,17 +1767,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getTotalDiskSpaceUsed()
     {
-        return metric.totalDiskSpaceUsed.count();
+        return metric.totalDiskSpaceUsed.getCount();
     }
 
     public long getLiveDiskSpaceUsed()
     {
-        return metric.liveDiskSpaceUsed.count();
+        return metric.liveDiskSpaceUsed.getCount();
     }
 
     public int getLiveSSTableCount()
     {
-        return metric.liveSSTableCount.value();
+        return metric.liveSSTableCount.getValue();
     }
 
     /**
@@ -2028,27 +2029,27 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long getBloomFilterFalsePositives()
     {
-        return metric.bloomFilterFalsePositives.value();
+        return metric.bloomFilterFalsePositives.getValue();
     }
 
     public long getRecentBloomFilterFalsePositives()
     {
-        return metric.recentBloomFilterFalsePositives.value();
+        return metric.recentBloomFilterFalsePositives.getValue();
     }
 
     public double getBloomFilterFalseRatio()
     {
-        return metric.bloomFilterFalseRatio.value();
+        return metric.bloomFilterFalseRatio.getValue();
     }
 
     public double getRecentBloomFilterFalseRatio()
     {
-        return metric.recentBloomFilterFalseRatio.value();
+        return metric.recentBloomFilterFalseRatio.getValue();
     }
 
     public long getBloomFilterDiskSpaceUsed()
     {
-        return metric.bloomFilterDiskSpaceUsed.value();
+        return metric.bloomFilterDiskSpaceUsed.getValue();
     }
 
     @Override
@@ -2159,17 +2160,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
 
     public long[] getEstimatedRowSizeHistogram()
     {
-        return metric.estimatedRowSizeHistogram.value();
+        return metric.estimatedRowSizeHistogram.getValue();
     }
 
     public long[] getEstimatedColumnCountHistogram()
     {
-        return metric.estimatedColumnCountHistogram.value();
+        return metric.estimatedColumnCountHistogram.getValue();
     }
 
     public double getCompressionRatio()
     {
-        return metric.compressionRatio.value();
+        return metric.compressionRatio.getValue();
     }
 
     /** true if this CFS contains secondary index data */

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
index 78b43d3..33f23a5 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java
@@ -265,7 +265,7 @@ public class CommitLog implements CommitLogMBean
      */
     public long getCompletedTasks()
     {
-        return metrics.completedTasks.value();
+        return metrics.completedTasks.getValue();
     }
 
     /**
@@ -273,7 +273,7 @@ public class CommitLog implements CommitLogMBean
      */
     public long getPendingTasks()
     {
-        return metrics.pendingTasks.value();
+        return metrics.pendingTasks.getValue();
     }
 
     /**
@@ -281,7 +281,7 @@ public class CommitLog implements CommitLogMBean
      */
     public long getTotalCommitlogSize()
     {
-        return metrics.totalCommitLogSize.value();
+        return metrics.totalCommitLogSize.getValue();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 35354c8..4e0b492 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -874,22 +874,22 @@ public class CompactionManager implements CompactionManagerMBean
 
     public long getTotalBytesCompacted()
     {
-        return metrics.bytesCompacted.count();
+        return metrics.bytesCompacted.getCount();
     }
 
     public long getTotalCompactionsCompleted()
     {
-        return metrics.totalCompactionsCompleted.count();
+        return metrics.totalCompactionsCompleted.getCount();
     }
 
     public int getPendingTasks()
     {
-        return metrics.pendingTasks.value();
+        return metrics.pendingTasks.getValue();
     }
 
     public long getCompletedTasks()
     {
-        return metrics.completedTasks.value();
+        return metrics.completedTasks.getValue();
     }
 
     private static class CleanupInfo extends CompactionInfo.Holder

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
index ff8c70a..6b04b92 100644
--- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
+++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
@@ -27,13 +27,13 @@ import java.util.concurrent.TimeUnit;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import com.codahale.metrics.ExponentiallyDecayingReservoir;
+
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.FBUtilities;
 
-import com.yammer.metrics.stats.ExponentiallyDecayingSample;
-
 /**
  * A dynamic snitch that sorts endpoints by latency with an adapted phi failure detector
  */
@@ -50,7 +50,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
 
     private final ConcurrentHashMap<InetAddress, Double> scores = new ConcurrentHashMap<InetAddress, Double>();
     private final ConcurrentHashMap<InetAddress, Long> lastReceived = new ConcurrentHashMap<InetAddress, Long>();
-    private final ConcurrentHashMap<InetAddress, ExponentiallyDecayingSample> samples = new ConcurrentHashMap<InetAddress, ExponentiallyDecayingSample>();
+    private final ConcurrentHashMap<InetAddress, ExponentiallyDecayingReservoir> samples = new ConcurrentHashMap<InetAddress, ExponentiallyDecayingReservoir>();
 
     public final IEndpointSnitch subsnitch;
 
@@ -203,10 +203,10 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
     {
         lastReceived.put(host, System.nanoTime());
 
-        ExponentiallyDecayingSample sample = samples.get(host);
+        ExponentiallyDecayingReservoir sample = samples.get(host);
         if (sample == null)
         {
-            ExponentiallyDecayingSample maybeNewSample = new ExponentiallyDecayingSample(WINDOW_SIZE, ALPHA);
+            ExponentiallyDecayingReservoir maybeNewSample = new ExponentiallyDecayingReservoir(WINDOW_SIZE, ALPHA);
             sample = samples.putIfAbsent(host, maybeNewSample);
             if (sample == null)
                 sample = maybeNewSample;
@@ -232,7 +232,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
         HashMap<InetAddress, Long> penalties = new HashMap<InetAddress, Long>(samples.size());
         // We're going to weight the latency and time since last reply for each host against the worst one we see, to arrive at sort of a 'badness percentage' for both of them.
         // first, find the worst for each.
-        for (Map.Entry<InetAddress, ExponentiallyDecayingSample> entry : samples.entrySet())
+        for (Map.Entry<InetAddress, ExponentiallyDecayingReservoir> entry : samples.entrySet())
         {
             double mean = entry.getValue().getSnapshot().getMedian();
             if (mean > maxLatency)
@@ -246,7 +246,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
                 maxPenalty = timePenalty;
         }
         // now make another pass to do the weighting based on the maximums we found before
-        for (Map.Entry<InetAddress, ExponentiallyDecayingSample> entry: samples.entrySet())
+        for (Map.Entry<InetAddress, ExponentiallyDecayingReservoir> entry: samples.entrySet())
         {
             double score = entry.getValue().getSnapshot().getMedian() / maxLatency;
             if (penalties.containsKey(entry.getKey()))
@@ -265,8 +265,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
 
     private void reset()
     {
-        for (ExponentiallyDecayingSample sample : samples.values())
-            sample.clear();
+        samples.clear();
     }
 
     public Map<InetAddress, Double> getScores()
@@ -295,7 +294,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
     {
         InetAddress host = InetAddress.getByName(hostname);
         ArrayList<Double> timings = new ArrayList<Double>();
-        ExponentiallyDecayingSample sample = samples.get(host);
+        ExponentiallyDecayingReservoir sample = samples.get(host);
         if (sample != null)
         {
             for (double time: sample.getSnapshot().getValues())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/CacheMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/CacheMetrics.java b/src/java/org/apache/cassandra/metrics/CacheMetrics.java
index 3157511..ba98ab3 100644
--- a/src/java/org/apache/cassandra/metrics/CacheMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/CacheMetrics.java
@@ -17,14 +17,12 @@
  */
 package org.apache.cassandra.metrics;
 
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricName;
-import com.yammer.metrics.util.RatioGauge;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Meter;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.RatioGauge;
 
 import org.apache.cassandra.cache.ICache;
 
@@ -60,37 +58,43 @@ public class CacheMetrics
      */
     public CacheMetrics(String type, final ICache cache)
     {
-        capacity = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Capacity", type), new Gauge<Long>()
+        capacity = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Capacity", type), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return cache.capacity();
             }
         });
-        hits = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Hits", type), "hits", TimeUnit.SECONDS);
-        requests = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Requests", type), "requests", TimeUnit.SECONDS);
-        hitRate = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "HitRate", type), new RatioGauge()
+        hits = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Hits", type));
+        
+        requests = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Requests", type));
+        hitRate = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "HitRate", type), new RatioGauge()
         {
             protected double getNumerator()
             {
-                return hits.count();
+                return hits.getCount();
             }
 
             protected double getDenominator()
             {
-                return requests.count();
+                return requests.getCount();
+            }
+            
+            public Ratio getRatio()
+            {
+                return Ratio.of(getNumerator(),  getDenominator());
             }
         });
-        size = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Size", type), new Gauge<Long>()
+        size = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Size", type), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return cache.weightedSize();
             }
         });
-        entries = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Entries", type), new Gauge<Integer>()
+        entries = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Entries", type), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 return cache.size();
             }
@@ -101,8 +105,8 @@ public class CacheMetrics
     @Deprecated
     public double getRecentHitRate()
     {
-        long r = requests.count();
-        long h = hits.count();
+        long r = requests.getCount();
+        long h = hits.getCount();
         try
         {
             return ((double)(h - lastHits.get())) / (r - lastRequests.get());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/CassandraMetricRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/CassandraMetricRegistry.java b/src/java/org/apache/cassandra/metrics/CassandraMetricRegistry.java
new file mode 100644
index 0000000..2f2a855
--- /dev/null
+++ b/src/java/org/apache/cassandra/metrics/CassandraMetricRegistry.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.metrics;
+
+import com.codahale.metrics.Metric;
+import com.codahale.metrics.MetricRegistry;
+
+public class CassandraMetricRegistry 
+{
+    private static MetricRegistry defaultRegistry = new MetricRegistry();
+    
+    private CassandraMetricRegistry()
+    {  
+    }
+    
+    public static MetricRegistry get()
+    {
+        return defaultRegistry;
+    }
+    
+    public static <T extends Metric> T register(String name, T metric) 
+    {
+        defaultRegistry.remove(name);
+        return defaultRegistry.register(name, metric);
+    }
+    
+    public static void unregister(String name)
+    {
+        defaultRegistry.remove(name);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/ClientRequestMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ClientRequestMetrics.java b/src/java/org/apache/cassandra/metrics/ClientRequestMetrics.java
index d6ff01b..89a5c73 100644
--- a/src/java/org/apache/cassandra/metrics/ClientRequestMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ClientRequestMetrics.java
@@ -20,18 +20,16 @@
  */
 package org.apache.cassandra.metrics;
 
-import java.util.concurrent.TimeUnit;
-
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.Meter;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Meter;
 
 public class ClientRequestMetrics extends LatencyMetrics
 {
-    @Deprecated public static final Counter readTimeouts = Metrics.newCounter(ClientRequestMetrics.class, "ReadTimeouts");
-    @Deprecated public static final Counter writeTimeouts = Metrics.newCounter(ClientRequestMetrics.class, "WriteTimeouts");
-    @Deprecated public static final Counter readUnavailables = Metrics.newCounter(ClientRequestMetrics.class, "ReadUnavailables");
-    @Deprecated public static final Counter writeUnavailables = Metrics.newCounter(ClientRequestMetrics.class, "WriteUnavailables");
+    @Deprecated public static final Counter readTimeouts = CassandraMetricRegistry.get().counter(MetricRegistry.name(ClientRequestMetrics.class, "ReadTimeouts"));
+    @Deprecated public static final Counter writeTimeouts = CassandraMetricRegistry.get().counter(MetricRegistry.name(ClientRequestMetrics.class, "WriteTimeouts"));
+    @Deprecated public static final Counter readUnavailables = CassandraMetricRegistry.get().counter(MetricRegistry.name(ClientRequestMetrics.class, "ReadUnavailables"));
+    @Deprecated public static final Counter writeUnavailables = CassandraMetricRegistry.get().counter(MetricRegistry.name(ClientRequestMetrics.class, "WriteUnavailables"));
 
     public final Meter timeouts;
     public final Meter unavailables;
@@ -40,14 +38,14 @@ public class ClientRequestMetrics extends LatencyMetrics
     {
         super("org.apache.cassandra.metrics", "ClientRequest", scope);
 
-        timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
-        unavailables = Metrics.newMeter(factory.createMetricName("Unavailables"), "unavailables", TimeUnit.SECONDS);
+        timeouts = CassandraMetricRegistry.get().meter(factory.createMetricName("Timeouts"));
+        unavailables = CassandraMetricRegistry.get().meter(factory.createMetricName("Unavailables"));
     }
 
     public void release()
     {
         super.release();
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("Timeouts"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("Unavailables"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("Timeouts"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("Unavailables"));
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
index 96ab538..0b1e5de 100644
--- a/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
@@ -17,19 +17,21 @@
  */
 package org.apache.cassandra.metrics;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.Histogram;
-import com.yammer.metrics.core.MetricName;
-import com.yammer.metrics.util.RatioGauge;
+
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Histogram;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.RatioGauge;
 
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.metrics.CassandraMetricRegistry;
 import org.apache.cassandra.io.sstable.SSTableMetadata;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.utils.EstimatedHistogram;
 
+
 /**
  * Metrics for {@link ColumnFamilyStore}.
  */
@@ -40,7 +42,7 @@ public class ColumnFamilyMetrics
     /** Total number of columns present in the memtable. */
     public final Gauge<Long> memtableColumnsCount;
     /** Number of times flush has resulted in the memtable being switched out. */
-    public final Counter memtableSwitchCount;
+    public Counter memtableSwitchCount;
     /** Current compression ratio for all SSTables */
     public final Gauge<Double> compressionRatio;
     /** Histogram of estimated row size (in bytes). */
@@ -97,24 +99,24 @@ public class ColumnFamilyMetrics
     {
         factory = new ColumnFamilyMetricNameFactory(cfs);
 
-        memtableColumnsCount = Metrics.newGauge(factory.createMetricName("MemtableColumnsCount"), new Gauge<Long>()
+        memtableColumnsCount = CassandraMetricRegistry.register(factory.createMetricName("MemtableColumnsCount"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return cfs.getDataTracker().getMemtable().getOperations();
             }
         });
-        memtableDataSize = Metrics.newGauge(factory.createMetricName("MemtableDataSize"), new Gauge<Long>()
+        memtableDataSize = CassandraMetricRegistry.register(factory.createMetricName("MemtableDataSize"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return cfs.getDataTracker().getMemtable().getLiveSize();
             }
         });
-        memtableSwitchCount = Metrics.newCounter(factory.createMetricName("MemtableSwitchCount"));
-        estimatedRowSizeHistogram = Metrics.newGauge(factory.createMetricName("EstimatedRowSizeHistogram"), new Gauge<long[]>()
+        memtableSwitchCount = CassandraMetricRegistry.get().counter(factory.createMetricName("MemtableSwitchCount"));
+        estimatedRowSizeHistogram = CassandraMetricRegistry.register(factory.createMetricName("EstimatedRowSizeHistogram"), new Gauge<long[]>()
         {
-            public long[] value()
+            public long[] getValue()
             {
                 long[] histogram = new long[90];
                 for (SSTableReader sstable : cfs.getSSTables())
@@ -126,9 +128,9 @@ public class ColumnFamilyMetrics
                 return histogram;
             }
         });
-        estimatedColumnCountHistogram = Metrics.newGauge(factory.createMetricName("EstimatedColumnCountHistogram"), new Gauge<long[]>()
+        estimatedColumnCountHistogram = CassandraMetricRegistry.register(factory.createMetricName("EstimatedColumnCountHistogram"), new Gauge<long[]>()
         {
-            public long[] value()
+            public long[] getValue()
             {
                 long[] histogram = new long[90];
                 for (SSTableReader sstable : cfs.getSSTables())
@@ -140,10 +142,10 @@ public class ColumnFamilyMetrics
                 return histogram;
             }
         });
-        sstablesPerReadHistogram = Metrics.newHistogram(factory.createMetricName("SSTablesPerReadHistogram"));
-        compressionRatio = Metrics.newGauge(factory.createMetricName("CompressionRatio"), new Gauge<Double>()
+        sstablesPerReadHistogram = CassandraMetricRegistry.get().histogram(factory.createMetricName("SSTablesPerReadHistogram"));
+        compressionRatio = CassandraMetricRegistry.register(factory.createMetricName("CompressionRatio"), new Gauge<Double>()
         {
-            public Double value()
+            public Double getValue()
             {
                 double sum = 0;
                 int total = 0;
@@ -160,26 +162,26 @@ public class ColumnFamilyMetrics
         });
         readLatency = new LatencyMetrics(factory, "Read");
         writeLatency = new LatencyMetrics(factory, "Write");
-        pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
+        pendingTasks = CassandraMetricRegistry.register(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 // TODO this actually isn't a good measure of pending tasks
                 return Keyspace.switchLock.getQueueLength();
             }
         });
-        liveSSTableCount = Metrics.newGauge(factory.createMetricName("LiveSSTableCount"), new Gauge<Integer>()
+        liveSSTableCount = CassandraMetricRegistry.register(factory.createMetricName("LiveSSTableCount"), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 return cfs.getDataTracker().getSSTables().size();
             }
         });
-        liveDiskSpaceUsed = Metrics.newCounter(factory.createMetricName("LiveDiskSpaceUsed"));
-        totalDiskSpaceUsed = Metrics.newCounter(factory.createMetricName("TotalDiskSpaceUsed"));
-        minRowSize = Metrics.newGauge(factory.createMetricName("MinRowSize"), new Gauge<Long>()
+        liveDiskSpaceUsed = CassandraMetricRegistry.get().counter(factory.createMetricName("LiveDiskSpaceUsed"));
+        totalDiskSpaceUsed = CassandraMetricRegistry.get().counter(factory.createMetricName("TotalDiskSpaceUsed"));
+        minRowSize = CassandraMetricRegistry.register(factory.createMetricName("MinRowSize"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long min = 0;
                 for (SSTableReader sstable : cfs.getSSTables())
@@ -190,9 +192,9 @@ public class ColumnFamilyMetrics
                 return min;
             }
         });
-        maxRowSize = Metrics.newGauge(factory.createMetricName("MaxRowSize"), new Gauge<Long>()
+        maxRowSize = CassandraMetricRegistry.register(factory.createMetricName("MaxRowSize"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long max = 0;
                 for (SSTableReader sstable : cfs.getSSTables())
@@ -203,9 +205,9 @@ public class ColumnFamilyMetrics
                 return max;
             }
         });
-        meanRowSize = Metrics.newGauge(factory.createMetricName("MeanRowSize"), new Gauge<Long>()
+        meanRowSize = CassandraMetricRegistry.register(factory.createMetricName("MeanRowSize"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long sum = 0;
                 long count = 0;
@@ -217,9 +219,9 @@ public class ColumnFamilyMetrics
                 return count > 0 ? sum / count : 0;
             }
         });
-        bloomFilterFalsePositives = Metrics.newGauge(factory.createMetricName("BloomFilterFalsePositives"), new Gauge<Long>()
+        bloomFilterFalsePositives = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterFalsePositives"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long count = 0L;
                 for (SSTableReader sstable: cfs.getSSTables())
@@ -227,9 +229,9 @@ public class ColumnFamilyMetrics
                 return count;
             }
         });
-        recentBloomFilterFalsePositives = Metrics.newGauge(factory.createMetricName("RecentBloomFilterFalsePositives"), new Gauge<Long>()
+        recentBloomFilterFalsePositives = CassandraMetricRegistry.register(factory.createMetricName("RecentBloomFilterFalsePositives"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long count = 0L;
                 for (SSTableReader sstable: cfs.getSSTables())
@@ -237,9 +239,9 @@ public class ColumnFamilyMetrics
                 return count;
             }
         });
-        bloomFilterFalseRatio = Metrics.newGauge(factory.createMetricName("BloomFilterFalseRatio"), new Gauge<Double>()
+        bloomFilterFalseRatio = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterFalseRatio"), new Gauge<Double>()
         {
-            public Double value()
+            public Double getValue()
             {
                 long falseCount = 0L;
                 long trueCount = 0L;
@@ -253,9 +255,9 @@ public class ColumnFamilyMetrics
                 return (double) falseCount / (trueCount + falseCount);
             }
         });
-        recentBloomFilterFalseRatio = Metrics.newGauge(factory.createMetricName("RecentBloomFilterFalseRatio"), new Gauge<Double>()
+        recentBloomFilterFalseRatio = CassandraMetricRegistry.register(factory.createMetricName("RecentBloomFilterFalseRatio"), new Gauge<Double>()
         {
-            public Double value()
+            public Double getValue()
             {
                 long falseCount = 0L;
                 long trueCount = 0L;
@@ -269,9 +271,9 @@ public class ColumnFamilyMetrics
                 return (double) falseCount / (trueCount + falseCount);
             }
         });
-        bloomFilterDiskSpaceUsed = Metrics.newGauge(factory.createMetricName("BloomFilterDiskSpaceUsed"), new Gauge<Long>()
+        bloomFilterDiskSpaceUsed = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterDiskSpaceUsed"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long total = 0;
                 for (SSTableReader sst : cfs.getSSTables())
@@ -279,8 +281,9 @@ public class ColumnFamilyMetrics
                 return total;
             }
         });
-        speculativeRetry = Metrics.newCounter(factory.createMetricName("SpeculativeRetry"));
-        keyCacheHitRate = Metrics.newGauge(factory.createMetricName("KeyCacheHitRate"), new RatioGauge()
+
+        speculativeRetry = CassandraMetricRegistry.get().counter(factory.createMetricName("SpeculativeRetry"));
+        keyCacheHitRate = CassandraMetricRegistry.register(factory.createMetricName("KeyCacheHitRate"), new RatioGauge()
         {
             protected double getNumerator()
             {
@@ -297,8 +300,19 @@ public class ColumnFamilyMetrics
                     requests += sstable.getKeyCacheRequest();
                 return Math.max(requests, 1); // to avoid NaN.
             }
+
+            @Override
+            protected Ratio getRatio() 
+            {
+                return Ratio.of(getNumerator(), getDenominator());
+            }
         });
     }
+    
+    public void resetMemTableSwitchCount()
+    {
+        memtableSwitchCount = CassandraMetricRegistry.get().counter(factory.createMetricName("MemtableSwitchCount"));
+    }
 
     public void updateSSTableIterated(int count)
     {
@@ -314,25 +328,25 @@ public class ColumnFamilyMetrics
     {
         readLatency.release();
         writeLatency.release();
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableColumnsCount"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableDataSize"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MemtableSwitchCount"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("CompressionRatio"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedRowSizeHistogram"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedColumnCountHistogram"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("SSTablesPerReadHistogram"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("LiveSSTableCount"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("LiveDiskSpaceUsed"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalDiskSpaceUsed"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MinRowSize"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MaxRowSize"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("MeanRowSize"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("BloomFilterFalsePositives"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("RecentBloomFilterFalsePositives"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("BloomFilterFalseRatio"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("RecentBloomFilterFalseRatio"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("BloomFilterDiskSpaceUsed"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MemtableColumnsCount"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MemtableDataSize"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MemtableSwitchCount"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("CompressionRatio"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("EstimatedRowSizeHistogram"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("EstimatedColumnCountHistogram"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("SSTablesPerReadHistogram"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("PendingTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("LiveSSTableCount"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("LiveDiskSpaceUsed"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("TotalDiskSpaceUsed"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MinRowSize"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MaxRowSize"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("MeanRowSize"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("BloomFilterFalsePositives"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("RecentBloomFilterFalsePositives"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("BloomFilterFalseRatio"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("RecentBloomFilterFalseRatio"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("BloomFilterDiskSpaceUsed"));
     }
 
     class ColumnFamilyMetricNameFactory implements MetricNameFactory
@@ -348,7 +362,7 @@ public class ColumnFamilyMetrics
             isIndex = cfs.isIndex();
         }
 
-        public MetricName createMetricName(String metricName)
+        public String createMetricName(String metricName)
         {
             String groupName = ColumnFamilyMetrics.class.getPackage().getName();
             String type = isIndex ? "IndexColumnFamily" : "ColumnFamily";
@@ -360,7 +374,7 @@ public class ColumnFamilyMetrics
             mbeanName.append(",scope=").append(columnFamilyName);
             mbeanName.append(",name=").append(metricName);
 
-            return new MetricName(groupName, type, metricName, keyspaceName + "." + columnFamilyName, mbeanName.toString());
+            return MetricRegistry.name(groupName, type, metricName, keyspaceName + "." + columnFamilyName, mbeanName.toString());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java b/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java
index 598d295..4b87038 100644
--- a/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/CommitLogMetrics.java
@@ -17,9 +17,8 @@
  */
 package org.apache.cassandra.metrics;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Gauge;
 
 import org.apache.cassandra.db.commitlog.CommitLogAllocator;
 import org.apache.cassandra.db.commitlog.ICommitLogExecutorService;
@@ -41,23 +40,23 @@ public class CommitLogMetrics
 
     public CommitLogMetrics(final ICommitLogExecutorService executor, final CommitLogAllocator allocator)
     {
-        completedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
+        completedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return executor.getCompletedTasks();
             }
         });
-        pendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Long>()
+        pendingTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return executor.getPendingTasks();
             }
         });
-        totalCommitLogSize = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "TotalCommitLogSize"), new Gauge<Long>()
+        totalCommitLogSize = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalCommitLogSize"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return allocator.bytesUsed();
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/CompactionMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/CompactionMetrics.java b/src/java/org/apache/cassandra/metrics/CompactionMetrics.java
index dd3803f..267d292 100644
--- a/src/java/org/apache/cassandra/metrics/CompactionMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/CompactionMetrics.java
@@ -19,13 +19,11 @@ package org.apache.cassandra.metrics;
 
 import java.util.*;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Meter;
 
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.ColumnFamilyStore;
@@ -55,9 +53,9 @@ public class CompactionMetrics implements CompactionManager.CompactionExecutorSt
 
     public CompactionMetrics(final ThreadPoolExecutor... collectors)
     {
-        pendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Integer>()
+        pendingTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 int n = 0;
                 for (String keyspaceName : Schema.instance.getKeyspaces())
@@ -70,9 +68,9 @@ public class CompactionMetrics implements CompactionManager.CompactionExecutorSt
                 return n;
             }
         });
-        completedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
+        completedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 long completedTasks = 0;
                 for (ThreadPoolExecutor collector : collectors)
@@ -80,8 +78,8 @@ public class CompactionMetrics implements CompactionManager.CompactionExecutorSt
                 return completedTasks;
             }
         });
-        totalCompactionsCompleted = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "TotalCompactionsCompleted"), "compaction completed", TimeUnit.SECONDS);
-        bytesCompacted = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "BytesCompacted"));
+        totalCompactionsCompleted = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalCompactionsCompleted"));
+        bytesCompacted = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "BytesCompacted"));
     }
 
     public void beginCompaction(CompactionInfo.Holder ci)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/ConnectionMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ConnectionMetrics.java b/src/java/org/apache/cassandra/metrics/ConnectionMetrics.java
index 5493505..24d3bbd 100644
--- a/src/java/org/apache/cassandra/metrics/ConnectionMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ConnectionMetrics.java
@@ -18,12 +18,10 @@
 package org.apache.cassandra.metrics;
 
 import java.net.InetAddress;
-import java.util.concurrent.TimeUnit;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Gauge;
+import com.codahale.metrics.Meter;
 
 import org.apache.cassandra.net.OutboundTcpConnectionPool;
 
@@ -36,7 +34,7 @@ public class ConnectionMetrics
     public static final String TYPE_NAME = "Connection";
 
     /** Total number of timeouts happened on this node */
-    public static final Meter totalTimeouts = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "TotalTimeouts"), "total timeouts", TimeUnit.SECONDS);
+    public static final Meter totalTimeouts = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalTimeouts"));
     private static long recentTimeouts;
 
     public final String address;
@@ -66,58 +64,58 @@ public class ConnectionMetrics
         // ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
         address = ip.getHostAddress().replaceAll(":", ".");
 
-        commandPendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CommandPendingTasks", address), new Gauge<Integer>()
+        commandPendingTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandPendingTasks", address), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 return connectionPool.cmdCon.getPendingMessages();
             }
         });
-        commandCompletedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CommandCompletedTasks", address), new Gauge<Long>()
+        commandCompletedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandCompletedTasks", address), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return connectionPool.cmdCon.getCompletedMesssages();
             }
         });
-        commandDroppedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CommandDroppedTasks", address), new Gauge<Long>()
+        commandDroppedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandDroppedTasks", address), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return connectionPool.cmdCon.getDroppedMessages();
             }
         });
-        responsePendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "ResponsePendingTasks", address), new Gauge<Integer>()
+        responsePendingTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "ResponsePendingTasks", address), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 return connectionPool.ackCon.getPendingMessages();
             }
         });
-        responseCompletedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "ResponseCompletedTasks", address), new Gauge<Long>()
+        responseCompletedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "ResponseCompletedTasks", address), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return connectionPool.ackCon.getCompletedMesssages();
             }
         });
-        timeouts = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Timeouts", address), "timeouts", TimeUnit.SECONDS);
+        timeouts = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Timeouts", address));
     }
 
     public void release()
     {
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "CommandPendingTasks", address));
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "CommandCompletedTasks", address));
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "CommandDroppedTasks", address));
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "ResponsePendingTasks", address));
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "ResponseCompletedTasks", address));
-        Metrics.defaultRegistry().removeMetric(new MetricName(GROUP_NAME, TYPE_NAME, "Timeouts", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandPendingTasks", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandCompletedTasks", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CommandDroppedTasks", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "ResponsePendingTasks", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "ResponseCompletedTasks", address));
+        CassandraMetricRegistry.unregister(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Timeouts", address));
     }
 
     @Deprecated
     public static long getRecentTotalTimeout()
     {
-        long total = totalTimeouts.count();
+        long total = totalTimeouts.getCount();
         long recent = total - recentTimeouts;
         recentTimeouts = total;
         return recent;
@@ -126,7 +124,7 @@ public class ConnectionMetrics
     @Deprecated
     public long getRecentTimeout()
     {
-        long timeoutCount = timeouts.count();
+        long timeoutCount = timeouts.getCount();
         long recent = timeoutCount - recentTimeoutCount;
         recentTimeoutCount = timeoutCount;
         return recent;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java b/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
index e0b12bb..9e77f24 100644
--- a/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
@@ -17,11 +17,8 @@
  */
 package org.apache.cassandra.metrics;
 
-import java.util.concurrent.TimeUnit;
-
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Meter;
 
 import org.apache.cassandra.net.MessagingService;
 
@@ -40,13 +37,13 @@ public class DroppedMessageMetrics
 
     public DroppedMessageMetrics(MessagingService.Verb verb)
     {
-        dropped = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Dropped", verb.toString()), "dropped", TimeUnit.SECONDS);
+        dropped = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Dropped", verb.toString()));
     }
 
     @Deprecated
     public int getRecentlyDropped()
     {
-        long currentDropped = dropped.count();
+        long currentDropped = dropped.getCount();
         long recentlyDropped = currentDropped - lastDropped;
         lastDropped = currentDropped;
         return (int)recentlyDropped;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/HintedHandoffMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/HintedHandoffMetrics.java b/src/java/org/apache/cassandra/metrics/HintedHandoffMetrics.java
index 0f3992f..a4cf004 100644
--- a/src/java/org/apache/cassandra/metrics/HintedHandoffMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/HintedHandoffMetrics.java
@@ -29,9 +29,8 @@ import org.slf4j.LoggerFactory;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
 
 /**
  * Metrics for {@link HintedHandOffManager}.
@@ -57,7 +56,7 @@ public class HintedHandoffMetrics
     {
         public Counter load(InetAddress address)
         {
-            return Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "Hints_created-" + address.getHostAddress()));
+            return CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Hints_created-" + address.getHostAddress()));
         }
     });
 
@@ -90,12 +89,12 @@ public class HintedHandoffMetrics
 
         public DifferencingCounter(InetAddress address)
         {
-            this.meter = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "Hints_not_stored-" + address.getHostAddress()));
+            this.meter = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Hints_not_stored-" + address.getHostAddress()));
         }
 
         public long diffrence()
         {
-            long current = meter.count();
+            long current = meter.getCount();
             long diffrence = current - reported;
             this.reported = current;
             return diffrence;
@@ -103,7 +102,7 @@ public class HintedHandoffMetrics
 
         public long count()
         {
-            return meter.count();
+            return meter.getCount();
         }
 
         public void mark()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/LatencyMetrics.java b/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
index d177613..76a1f26 100644
--- a/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
@@ -19,10 +19,9 @@ package org.apache.cassandra.metrics;
 
 import java.util.concurrent.TimeUnit;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.MetricName;
-import com.yammer.metrics.core.Timer;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
+import com.codahale.metrics.Timer;
 
 import org.apache.cassandra.utils.EstimatedHistogram;
 
@@ -80,8 +79,8 @@ public class LatencyMetrics
         this.factory = factory;
         this.namePrefix = namePrefix;
 
-        latency = Metrics.newTimer(factory.createMetricName(namePrefix + "Latency"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
-        totalLatency = Metrics.newCounter(factory.createMetricName(namePrefix + "TotalLatency"));
+        latency = CassandraMetricRegistry.get().timer(factory.createMetricName(namePrefix + "Latency"));
+        totalLatency = CassandraMetricRegistry.get().counter(factory.createMetricName(namePrefix + "TotalLatency"));
     }
 
     /** takes nanoseconds **/
@@ -101,15 +100,15 @@ public class LatencyMetrics
 
     public void release()
     {
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName(namePrefix + "Latency"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName(namePrefix + "TotalLatency"));
+        CassandraMetricRegistry.unregister(factory.createMetricName(namePrefix + "Latency"));
+        CassandraMetricRegistry.unregister(factory.createMetricName(namePrefix + "TotalLatency"));
     }
 
     @Deprecated
     public double getRecentLatency()
     {
-        long ops = latency.count();
-        long n = totalLatency.count();
+        long ops = latency.getCount();
+        long n = totalLatency.getCount();
         try
         {
             return ((double) n - lastLatency) / (ops - lastOpCount);
@@ -134,9 +133,9 @@ public class LatencyMetrics
             this.scope = scope;
         }
 
-        public MetricName createMetricName(String metricName)
+        public String createMetricName(String metricName)
         {
-            return new MetricName(group, type, metricName, scope);
+            return MetricRegistry.name(group, type, metricName, scope);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/MetricNameFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/MetricNameFactory.java b/src/java/org/apache/cassandra/metrics/MetricNameFactory.java
index 5c1a5c2..d728e40 100644
--- a/src/java/org/apache/cassandra/metrics/MetricNameFactory.java
+++ b/src/java/org/apache/cassandra/metrics/MetricNameFactory.java
@@ -17,8 +17,6 @@
  */
 package org.apache.cassandra.metrics;
 
-import com.yammer.metrics.core.MetricName;
-
 public interface MetricNameFactory
 {
     /**
@@ -27,5 +25,5 @@ public interface MetricNameFactory
      * @param metricName Name part of {@link MetricName}.
      * @return new MetricName with given metric name.
      */
-    MetricName createMetricName(String metricName);
+    String createMetricName(String metricName);
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/ReadRepairMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ReadRepairMetrics.java b/src/java/org/apache/cassandra/metrics/ReadRepairMetrics.java
index c67ed90..605876c 100644
--- a/src/java/org/apache/cassandra/metrics/ReadRepairMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ReadRepairMetrics.java
@@ -20,12 +20,8 @@ package org.apache.cassandra.metrics;
  * 
  */
 
-
-import java.util.concurrent.TimeUnit;
-
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Meter;
 
 /**
  * Metrics related to Read Repair.
@@ -35,9 +31,9 @@ public class ReadRepairMetrics {
     public static final String TYPE_NAME = "ReadRepair";
     
     public static final Meter repairedBlocking =
-            Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "RepairedBlocking"), "RepairedBlocking", TimeUnit.SECONDS);
+            CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "RepairedBlocking"));
     public static final Meter repairedBackground =
-            Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "RepairedBackground"), "RepairedBackground", TimeUnit.SECONDS);
+            CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "RepairedBackground"));
     public static final Meter attempted = 
-            Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Attempted"), "Attempted", TimeUnit.SECONDS);
+            CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Attempted"));
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/StorageMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/StorageMetrics.java b/src/java/org/apache/cassandra/metrics/StorageMetrics.java
index 3cda71e..02e8e12 100644
--- a/src/java/org/apache/cassandra/metrics/StorageMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/StorageMetrics.java
@@ -17,14 +17,13 @@
  */
 package org.apache.cassandra.metrics;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
 
 /**
  * Metrics related to Storage.
  */
 public class StorageMetrics
 {
-    public static final Counter load = Metrics.newCounter(new MetricName("org.apache.cassandra.metrics", "Storage", "Load"));
+    public static final Counter load = CassandraMetricRegistry.get().counter(MetricRegistry.name("org.apache.cassandra.metrics", "Storage", "Load"));
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/StreamingMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/StreamingMetrics.java b/src/java/org/apache/cassandra/metrics/StreamingMetrics.java
index 96c79c9..bca50d8 100644
--- a/src/java/org/apache/cassandra/metrics/StreamingMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/StreamingMetrics.java
@@ -20,9 +20,8 @@ package org.apache.cassandra.metrics;
 import java.net.InetAddress;
 import java.util.concurrent.ConcurrentMap;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.MetricName;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Counter;
 import org.cliffc.high_scale_lib.NonBlockingHashMap;
 
 /**
@@ -35,9 +34,9 @@ public class StreamingMetrics
 
     private static final ConcurrentMap<InetAddress, StreamingMetrics> instances = new NonBlockingHashMap<InetAddress, StreamingMetrics>();
 
-    public static final Counter activeStreamsOutbound = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "ActiveOutboundStreams"));
-    public static final Counter totalIncomingBytes = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "TotalIncomingBytes"));
-    public static final Counter totalOutgoingBytes = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "TotalOutgoingBytes"));
+    public static final Counter activeStreamsOutbound = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "ActiveOutboundStreams"));
+    public static final Counter totalIncomingBytes = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalIncomingBytes"));
+    public static final Counter totalOutgoingBytes = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalOutgoingBytes"));
     public final Counter incomingBytes;
     public final Counter outgoingBytes;
 
@@ -54,7 +53,7 @@ public class StreamingMetrics
 
     public StreamingMetrics(final InetAddress peer)
     {
-        incomingBytes = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "IncomingBytes", peer.getHostAddress().replaceAll(":", ".")));
-        outgoingBytes= Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "OutgoingBytes", peer.getHostAddress().replaceAll(":", ".")));
+        incomingBytes = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "IncomingBytes", peer.getHostAddress().replaceAll(":", ".")));
+        outgoingBytes= CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "OutgoingBytes", peer.getHostAddress().replaceAll(":", ".")));
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/metrics/ThreadPoolMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/ThreadPoolMetrics.java b/src/java/org/apache/cassandra/metrics/ThreadPoolMetrics.java
index af54cdb..2a3776e 100644
--- a/src/java/org/apache/cassandra/metrics/ThreadPoolMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/ThreadPoolMetrics.java
@@ -19,8 +19,8 @@ package org.apache.cassandra.metrics;
 
 import java.util.concurrent.ThreadPoolExecutor;
 
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.*;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.*;
 
 /**
  * Metrics for {@link ThreadPoolExecutor}.
@@ -54,25 +54,25 @@ public class ThreadPoolMetrics
     {
         this.factory = new ThreadPoolMetricNameFactory(path, poolName);
 
-        activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
+        activeTasks = CassandraMetricRegistry.register(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
         {
-            public Integer value()
+            public Integer getValue()
             {
                 return executor.getActiveCount();
             }
         });
-        totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks"));
-        currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks"));
-        completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
+        totalBlocked = CassandraMetricRegistry.get().counter(factory.createMetricName("TotalBlockedTasks"));
+        currentBlocked = CassandraMetricRegistry.get().counter(factory.createMetricName("CurrentlyBlockedTasks"));
+        completedTasks = CassandraMetricRegistry.register(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return executor.getCompletedTaskCount();
             }
         });
-        pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
+        pendingTasks = CassandraMetricRegistry.register(factory.createMetricName("PendingTasks"), new Gauge<Long>()
         {
-            public Long value()
+            public Long getValue()
             {
                 return executor.getTaskCount() - executor.getCompletedTaskCount();
             }
@@ -81,11 +81,11 @@ public class ThreadPoolMetrics
 
     public void release()
     {
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("ActiveTasks"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("PendingTasks"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("CompletedTasks"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("TotalBlockedTasks"));
-        Metrics.defaultRegistry().removeMetric(factory.createMetricName("CurrentlyBlockedTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("ActiveTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("PendingTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("CompletedTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("TotalBlockedTasks"));
+        CassandraMetricRegistry.unregister(factory.createMetricName("CurrentlyBlockedTasks"));
     }
 
     class ThreadPoolMetricNameFactory implements MetricNameFactory
@@ -99,7 +99,7 @@ public class ThreadPoolMetrics
             this.poolName = poolName;
         }
 
-        public MetricName createMetricName(String metricName)
+        public String createMetricName(String metricName)
         {
             String groupName = ThreadPoolMetrics.class.getPackage().getName();
             String type = "ThreadPools";
@@ -110,7 +110,7 @@ public class ThreadPoolMetrics
             mbeanName.append(",scope=").append(poolName);
             mbeanName.append(",name=").append(metricName);
 
-            return new MetricName(groupName, type, metricName, path + "." + poolName, mbeanName.toString());
+            return MetricRegistry.name(groupName, type, metricName, path + "." + poolName, mbeanName.toString());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index 40b9f0e..ac89e71 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -782,7 +782,7 @@ public final class MessagingService implements MessagingServiceMBean
         boolean logTpstats = false;
         for (Map.Entry<Verb, DroppedMessageMetrics> entry : droppedMessages.entrySet())
         {
-            int dropped = (int) entry.getValue().dropped.count();
+            int dropped = (int) entry.getValue().dropped.getCount();
             Verb verb = entry.getKey();
             int recent = dropped - lastDroppedInternal.get(verb);
             if (recent > 0)
@@ -919,7 +919,7 @@ public final class MessagingService implements MessagingServiceMBean
     {
         Map<String, Integer> map = new HashMap<String, Integer>();
         for (Map.Entry<Verb, DroppedMessageMetrics> entry : droppedMessages.entrySet())
-            map.put(entry.getKey().toString(), (int) entry.getValue().dropped.count());
+            map.put(entry.getKey().toString(), (int) entry.getValue().dropped.getCount());
         return map;
     }
 
@@ -933,7 +933,7 @@ public final class MessagingService implements MessagingServiceMBean
 
     public long getTotalTimeouts()
     {
-        return ConnectionMetrics.totalTimeouts.count();
+        return ConnectionMetrics.totalTimeouts.getCount();
     }
 
     public long getRecentTotalTimouts()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index 81168c6..87312e4 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -101,7 +101,7 @@ public class OutboundTcpConnectionPool
 
     public long getTimeouts()
     {
-       return metrics.timeouts.count();
+       return metrics.timeouts.getCount();
     }
 
     public long getRecentTimeouts()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/scheduler/WeightedQueue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/scheduler/WeightedQueue.java b/src/java/org/apache/cassandra/scheduler/WeightedQueue.java
index 2d2e0bd..b3ea53d 100644
--- a/src/java/org/apache/cassandra/scheduler/WeightedQueue.java
+++ b/src/java/org/apache/cassandra/scheduler/WeightedQueue.java
@@ -90,12 +90,12 @@ class WeightedQueue implements WeightedQueueMBean
 
     public long getOperations()
     {
-        return metric.latency.count();
+        return metric.latency.getCount();
     }
 
     public long getTotalLatencyMicros()
     {
-        return metric.totalLatency.count();
+        return metric.totalLatency.getCount();
     }
 
     public double getRecentLatencyMicros()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/service/CacheService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CacheService.java b/src/java/org/apache/cassandra/service/CacheService.java
index b787b75..16afc5a 100644
--- a/src/java/org/apache/cassandra/service/CacheService.java
+++ b/src/java/org/apache/cassandra/service/CacheService.java
@@ -151,22 +151,22 @@ public class CacheService implements CacheServiceMBean
 
     public long getKeyCacheHits()
     {
-        return keyCache.getMetrics().hits.count();
+        return keyCache.getMetrics().hits.getCount();
     }
 
     public long getRowCacheHits()
     {
-        return rowCache.getMetrics().hits.count();
+        return rowCache.getMetrics().hits.getCount();
     }
 
     public long getKeyCacheRequests()
     {
-        return keyCache.getMetrics().requests.count();
+        return keyCache.getMetrics().requests.getCount();
     }
 
     public long getRowCacheRequests()
     {
-        return rowCache.getMetrics().requests.count();
+        return rowCache.getMetrics().requests.getCount();
     }
 
     public double getKeyCacheRecentHitRate()
@@ -219,7 +219,7 @@ public class CacheService implements CacheServiceMBean
 
     public long getRowCacheCapacityInBytes()
     {
-        return rowCache.getMetrics().capacity.value();
+        return rowCache.getMetrics().capacity.getValue();
     }
 
     public long getRowCacheCapacityInMB()
@@ -237,7 +237,7 @@ public class CacheService implements CacheServiceMBean
 
     public long getKeyCacheCapacityInBytes()
     {
-        return keyCache.getMetrics().capacity.value();
+        return keyCache.getMetrics().capacity.getValue();
     }
 
     public long getKeyCacheCapacityInMB()
@@ -255,7 +255,7 @@ public class CacheService implements CacheServiceMBean
 
     public long getRowCacheSize()
     {
-        return rowCache.getMetrics().size.value();
+        return rowCache.getMetrics().size.getValue();
     }
 
     public long getRowCacheEntries()
@@ -265,7 +265,7 @@ public class CacheService implements CacheServiceMBean
 
     public long getKeyCacheSize()
     {
-        return keyCache.getMetrics().size.value();
+        return keyCache.getMetrics().size.getValue();
     }
 
     public long getKeyCacheEntries()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index fb5cbe4..2056b49 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -1668,12 +1668,12 @@ public class StorageProxy implements StorageProxyMBean
 
     public long getReadOperations()
     {
-        return readMetrics.latency.count();
+        return readMetrics.latency.getCount();
     }
 
     public long getTotalReadLatencyMicros()
     {
-        return readMetrics.totalLatency.count();
+        return readMetrics.totalLatency.getCount();
     }
 
     public double getRecentReadLatencyMicros()
@@ -1693,12 +1693,12 @@ public class StorageProxy implements StorageProxyMBean
 
     public long getRangeOperations()
     {
-        return rangeMetrics.latency.count();
+        return rangeMetrics.latency.getCount();
     }
 
     public long getTotalRangeLatencyMicros()
     {
-        return rangeMetrics.totalLatency.count();
+        return rangeMetrics.totalLatency.getCount();
     }
 
     public double getRecentRangeLatencyMicros()
@@ -1718,12 +1718,12 @@ public class StorageProxy implements StorageProxyMBean
 
     public long getWriteOperations()
     {
-        return writeMetrics.latency.count();
+        return writeMetrics.latency.getCount();
     }
 
     public long getTotalWriteLatencyMicros()
     {
-        return writeMetrics.totalLatency.count();
+        return writeMetrics.totalLatency.getCount();
     }
 
     public double getRecentWriteLatencyMicros()
@@ -1988,14 +1988,14 @@ public class StorageProxy implements StorageProxyMBean
 
     
     public long getReadRepairAttempted() {
-        return ReadRepairMetrics.attempted.count();
+        return ReadRepairMetrics.attempted.getCount();
     }
     
     public long getReadRepairRepairedBlocking() {
-        return ReadRepairMetrics.repairedBlocking.count();
+        return ReadRepairMetrics.repairedBlocking.getCount();
     }
     
     public long getReadRepairRepairedBackground() {
-        return ReadRepairMetrics.repairedBackground.count();
+        return ReadRepairMetrics.repairedBackground.getCount();
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c27a1619/test/unit/org/apache/cassandra/db/KeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyspaceTest.java b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
index faee4e7..9b5b6dd 100644
--- a/test/unit/org/apache/cassandra/db/KeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
@@ -467,18 +467,18 @@ public class KeyspaceTest extends SchemaLoader
             rm.apply();
             cfStore.forceBlockingFlush();
         }
-        cfStore.metric.sstablesPerReadHistogram.clear();
+        //cfStore.metric.sstablesPerReadHistogram.clear();
         ColumnFamily cf = cfStore.getColumnFamily(key, ByteBufferUtil.bytes(""), ByteBufferUtil.bytes("col1499"), false, 1000, System.currentTimeMillis());
-        assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 5, 0.1);
+        assertEquals(cfStore.metric.sstablesPerReadHistogram.getSnapshot().getMax(), 5, 0.1);
         int i = 0;
         for (Column c : cf.getSortedColumns())
         {
             assertEquals(ByteBufferUtil.string(c.name), "col" + (1000 + i++));
         }
         assertEquals(i, 500);
-        cfStore.metric.sstablesPerReadHistogram.clear();
+        //cfStore.metric.sstablesPerReadHistogram.clear();
         cf = cfStore.getColumnFamily(key, ByteBufferUtil.bytes("col1500"), ByteBufferUtil.bytes("col2000"), false, 1000, System.currentTimeMillis());
-        assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 5, 0.1);
+        assertEquals(cfStore.metric.sstablesPerReadHistogram.getSnapshot().getMax(), 5, 0.1);
 
         for (Column c : cf.getSortedColumns())
         {
@@ -487,9 +487,9 @@ public class KeyspaceTest extends SchemaLoader
         assertEquals(i, 1000);
 
         // reverse
-        cfStore.metric.sstablesPerReadHistogram.clear();
+        //cfStore.metric.sstablesPerReadHistogram.clear();
         cf = cfStore.getColumnFamily(key, ByteBufferUtil.bytes("col2000"), ByteBufferUtil.bytes("col1500"), true, 1000, System.currentTimeMillis());
-        assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 5, 0.1);
+        assertEquals(cfStore.metric.sstablesPerReadHistogram.getSnapshot().getMax(), 5, 0.1);
         i = 500;
         for (Column c : cf.getSortedColumns())
         {
@@ -536,13 +536,13 @@ public class KeyspaceTest extends SchemaLoader
         }
         ByteBuffer start = ct.builder().add(ByteBufferUtil.bytes("a5")).add(ByteBufferUtil.bytes(85)).build();
         ByteBuffer finish = ct.builder().add(ByteBufferUtil.bytes("a5")).buildAsEndOfRange();
-        cfs.metric.sstablesPerReadHistogram.clear();
+        //cfs.metric.sstablesPerReadHistogram.clear();
         ColumnFamily cf = cfs.getColumnFamily(key, start, finish, false, 1000, System.currentTimeMillis());
         int colCount = 0;
         for (Column c : cf)
             colCount++;
         assertEquals(2, colCount);
-        assertEquals(2, cfs.metric.sstablesPerReadHistogram.max(), 0.1);
+        assertEquals(2, cfs.metric.sstablesPerReadHistogram.getSnapshot().getMax(), 0.1);
     }
 
     private void validateSliceLarge(ColumnFamilyStore cfStore) throws IOException


Mime
View raw message