Revert CASSANDRA-5838

This commit is contained in:
Jonathan Ellis 2013-08-30 13:27:00 -05:00
parent 14da6bca01
commit 3205e5dbbc
46 changed files with 337 additions and 402 deletions

View File

@ -375,7 +375,7 @@
<dependency groupId="org.apache.cassandra" artifactId="cassandra-all" version="${version}" />
<dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift" version="${version}" />
<dependency groupId="com.codahale.metrics" artifactId="metrics-core" version="3.0.1" />
<dependency groupId="com.yammer.metrics" artifactId="metrics-core" version="2.2.0" />
<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" />
@ -454,7 +454,7 @@
<dependency groupId="org.yaml" artifactId="snakeyaml"/>
<dependency groupId="edu.stanford.ppl" artifactId="snaptree"/>
<dependency groupId="org.mindrot" artifactId="jbcrypt"/>
<dependency groupId="com.codahale.metrics" artifactId="metrics-core"/>
<dependency groupId="com.yammer.metrics" artifactId="metrics-core"/>
<dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.0"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core"/>

BIN
lib/metrics-core-2.0.3.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -151,12 +151,12 @@ public class JMXEnabledThreadPoolExecutor extends DebuggableThreadPoolExecutor i
public int getTotalBlockedTasks()
{
return (int) metrics.totalBlocked.getCount();
return (int) metrics.totalBlocked.count();
}
public int getCurrentlyBlockedTasks()
{
return (int) metrics.currentBlocked.getCount();
return (int) metrics.currentBlocked.count();
}
public int getCoreThreads()

View File

@ -26,7 +26,6 @@ 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;
@ -34,9 +33,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;
@ -67,7 +66,6 @@ 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;
@ -306,6 +304,7 @@ 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:
@ -361,17 +360,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getMinRowSize()
{
return metric.minRowSize.getValue();
return metric.minRowSize.value();
}
public long getMaxRowSize()
{
return metric.maxRowSize.getValue();
return metric.maxRowSize.value();
}
public long getMeanRowSize()
{
return metric.meanRowSize.getValue();
return metric.meanRowSize.value();
}
public int getMeanColumns()
@ -739,8 +738,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
}
}
if (metric.memtableSwitchCount.getCount() == Long.MAX_VALUE)
metric.resetMemTableSwitchCount();
if (metric.memtableSwitchCount.count() == Long.MAX_VALUE)
metric.memtableSwitchCount.clear();
metric.memtableSwitchCount.inc();
// when all the memtables have been written, including for indexes, mark the flush in the commitlog header.
@ -848,7 +847,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
while (true)
{
long last = liveRatioComputedAt.get();
long operations = metric.writeLatency.latency.getCount();
long operations = metric.writeLatency.latency.count();
if (operations < 2 * last)
break;
if (liveRatioComputedAt.compareAndSet(last, operations))
@ -1087,12 +1086,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getMemtableColumnsCount()
{
return metric.memtableColumnsCount.getValue();
return metric.memtableColumnsCount.value();
}
public long getMemtableDataSize()
{
return metric.memtableDataSize.getValue();
return metric.memtableDataSize.value();
}
public long getTotalMemtableLiveSize()
@ -1102,7 +1101,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public int getMemtableSwitchCount()
{
return (int) metric.memtableSwitchCount.getCount();
return (int) metric.memtableSwitchCount.count();
}
private Memtable getMemtableThreadSafe()
@ -1140,7 +1139,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getReadCount()
{
return metric.readLatency.latency.getCount();
return metric.readLatency.latency.count();
}
public double getRecentReadLatencyMicros()
@ -1160,22 +1159,22 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getTotalReadLatencyMicros()
{
return metric.readLatency.totalLatency.getCount();
return metric.readLatency.totalLatency.count();
}
public int getPendingTasks()
{
return metric.pendingTasks.getValue();
return metric.pendingTasks.value();
}
public long getWriteCount()
{
return metric.writeLatency.latency.getCount();
return metric.writeLatency.latency.count();
}
public long getTotalWriteLatencyMicros()
{
return metric.writeLatency.totalLatency.getCount();
return metric.writeLatency.totalLatency.count();
}
public double getRecentWriteLatencyMicros()
@ -1790,17 +1789,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getTotalDiskSpaceUsed()
{
return metric.totalDiskSpaceUsed.getCount();
return metric.totalDiskSpaceUsed.count();
}
public long getLiveDiskSpaceUsed()
{
return metric.liveDiskSpaceUsed.getCount();
return metric.liveDiskSpaceUsed.count();
}
public int getLiveSSTableCount()
{
return metric.liveSSTableCount.getValue();
return metric.liveSSTableCount.value();
}
/**
@ -2052,27 +2051,27 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long getBloomFilterFalsePositives()
{
return metric.bloomFilterFalsePositives.getValue();
return metric.bloomFilterFalsePositives.value();
}
public long getRecentBloomFilterFalsePositives()
{
return metric.recentBloomFilterFalsePositives.getValue();
return metric.recentBloomFilterFalsePositives.value();
}
public double getBloomFilterFalseRatio()
{
return metric.bloomFilterFalseRatio.getValue();
return metric.bloomFilterFalseRatio.value();
}
public double getRecentBloomFilterFalseRatio()
{
return metric.recentBloomFilterFalseRatio.getValue();
return metric.recentBloomFilterFalseRatio.value();
}
public long getBloomFilterDiskSpaceUsed()
{
return metric.bloomFilterDiskSpaceUsed.getValue();
return metric.bloomFilterDiskSpaceUsed.value();
}
@Override
@ -2183,17 +2182,17 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
public long[] getEstimatedRowSizeHistogram()
{
return metric.estimatedRowSizeHistogram.getValue();
return metric.estimatedRowSizeHistogram.value();
}
public long[] getEstimatedColumnCountHistogram()
{
return metric.estimatedColumnCountHistogram.getValue();
return metric.estimatedColumnCountHistogram.value();
}
public double getCompressionRatio()
{
return metric.compressionRatio.getValue();
return metric.compressionRatio.value();
}
/** true if this CFS contains secondary index data */

View File

@ -265,7 +265,7 @@ public class CommitLog implements CommitLogMBean
*/
public long getCompletedTasks()
{
return metrics.completedTasks.getValue();
return metrics.completedTasks.value();
}
/**
@ -273,7 +273,7 @@ public class CommitLog implements CommitLogMBean
*/
public long getPendingTasks()
{
return metrics.pendingTasks.getValue();
return metrics.pendingTasks.value();
}
/**
@ -281,7 +281,7 @@ public class CommitLog implements CommitLogMBean
*/
public long getTotalCommitlogSize()
{
return metrics.totalCommitLogSize.getValue();
return metrics.totalCommitLogSize.value();
}
/**

View File

@ -1010,22 +1010,22 @@ public class CompactionManager implements CompactionManagerMBean
public long getTotalBytesCompacted()
{
return metrics.bytesCompacted.getCount();
return metrics.bytesCompacted.count();
}
public long getTotalCompactionsCompleted()
{
return metrics.totalCompactionsCompleted.getCount();
return metrics.totalCompactionsCompleted.count();
}
public int getPendingTasks()
{
return metrics.pendingTasks.getValue();
return metrics.pendingTasks.value();
}
public long getCompletedTasks()
{
return metrics.completedTasks.getValue();
return metrics.completedTasks.value();
}
private static class CleanupInfo extends CompactionInfo.Holder

View File

@ -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, ExponentiallyDecayingReservoir> samples = new ConcurrentHashMap<InetAddress, ExponentiallyDecayingReservoir>();
private final ConcurrentHashMap<InetAddress, ExponentiallyDecayingSample> samples = new ConcurrentHashMap<InetAddress, ExponentiallyDecayingSample>();
public final IEndpointSnitch subsnitch;
@ -203,10 +203,10 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
{
lastReceived.put(host, System.nanoTime());
ExponentiallyDecayingReservoir sample = samples.get(host);
ExponentiallyDecayingSample sample = samples.get(host);
if (sample == null)
{
ExponentiallyDecayingReservoir maybeNewSample = new ExponentiallyDecayingReservoir(WINDOW_SIZE, ALPHA);
ExponentiallyDecayingSample maybeNewSample = new ExponentiallyDecayingSample(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, ExponentiallyDecayingReservoir> entry : samples.entrySet())
for (Map.Entry<InetAddress, ExponentiallyDecayingSample> 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, ExponentiallyDecayingReservoir> entry: samples.entrySet())
for (Map.Entry<InetAddress, ExponentiallyDecayingSample> entry: samples.entrySet())
{
double score = entry.getValue().getSnapshot().getMedian() / maxLatency;
if (penalties.containsKey(entry.getKey()))
@ -265,7 +265,8 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
private void reset()
{
samples.clear();
for (ExponentiallyDecayingSample sample : samples.values())
sample.clear();
}
public Map<InetAddress, Double> getScores()
@ -294,7 +295,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
{
InetAddress host = InetAddress.getByName(hostname);
ArrayList<Double> timings = new ArrayList<Double>();
ExponentiallyDecayingReservoir sample = samples.get(host);
ExponentiallyDecayingSample sample = samples.get(host);
if (sample != null)
{
for (double time: sample.getSnapshot().getValues())

View File

@ -17,12 +17,14 @@
*/
package org.apache.cassandra.metrics;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.RatioGauge;
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 org.apache.cassandra.cache.ICache;
@ -58,43 +60,37 @@ public class CacheMetrics
*/
public CacheMetrics(String type, final ICache cache)
{
capacity = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Capacity", type), new Gauge<Long>()
capacity = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Capacity", type), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return cache.capacity();
}
});
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()
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()
{
protected double getNumerator()
{
return hits.getCount();
return hits.count();
}
protected double getDenominator()
{
return requests.getCount();
}
public Ratio getRatio()
{
return Ratio.of(getNumerator(), getDenominator());
return requests.count();
}
});
size = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Size", type), new Gauge<Long>()
size = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Size", type), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return cache.weightedSize();
}
});
entries = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Entries", type), new Gauge<Integer>()
entries = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "Entries", type), new Gauge<Integer>()
{
public Integer getValue()
public Integer value()
{
return cache.size();
}
@ -105,8 +101,8 @@ public class CacheMetrics
@Deprecated
public double getRecentHitRate()
{
long r = requests.getCount();
long h = hits.getCount();
long r = requests.count();
long h = hits.count();
try
{
return ((double)(h - lastHits.get())) / (r - lastRequests.get());

View File

@ -1,52 +0,0 @@
/*
* 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.JmxReporter;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;
public class CassandraMetricRegistry
{
private static MetricRegistry defaultRegistry = new MetricRegistry();
static
{
JmxReporter reporter = JmxReporter.forRegistry(defaultRegistry).build();
reporter.start();
}
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);
}
}

View File

@ -20,16 +20,18 @@
*/
package org.apache.cassandra.metrics;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Meter;
import java.util.concurrent.TimeUnit;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
import com.yammer.metrics.core.Meter;
public class ClientRequestMetrics extends LatencyMetrics
{
@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"));
@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");
public final Meter timeouts;
public final Meter unavailables;
@ -38,14 +40,14 @@ public class ClientRequestMetrics extends LatencyMetrics
{
super("org.apache.cassandra.metrics", "ClientRequest", scope);
timeouts = CassandraMetricRegistry.get().meter(factory.createMetricName("Timeouts"));
unavailables = CassandraMetricRegistry.get().meter(factory.createMetricName("Unavailables"));
timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
unavailables = Metrics.newMeter(factory.createMetricName("Unavailables"), "unavailables", TimeUnit.SECONDS);
}
public void release()
{
super.release();
CassandraMetricRegistry.unregister(factory.createMetricName("Timeouts"));
CassandraMetricRegistry.unregister(factory.createMetricName("Unavailables"));
Metrics.defaultRegistry().removeMetric(factory.createMetricName("Timeouts"));
Metrics.defaultRegistry().removeMetric(factory.createMetricName("Unavailables"));
}
}

View File

@ -17,21 +17,19 @@
*/
package org.apache.cassandra.metrics;
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 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 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}.
*/
@ -42,7 +40,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 Counter memtableSwitchCount;
public final Counter memtableSwitchCount;
/** Current compression ratio for all SSTables */
public final Gauge<Double> compressionRatio;
/** Histogram of estimated row size (in bytes). */
@ -99,24 +97,24 @@ public class ColumnFamilyMetrics
{
factory = new ColumnFamilyMetricNameFactory(cfs);
memtableColumnsCount = CassandraMetricRegistry.register(factory.createMetricName("MemtableColumnsCount"), new Gauge<Long>()
memtableColumnsCount = Metrics.newGauge(factory.createMetricName("MemtableColumnsCount"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return cfs.getDataTracker().getMemtable().getOperations();
}
});
memtableDataSize = CassandraMetricRegistry.register(factory.createMetricName("MemtableDataSize"), new Gauge<Long>()
memtableDataSize = Metrics.newGauge(factory.createMetricName("MemtableDataSize"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return cfs.getDataTracker().getMemtable().getLiveSize();
}
});
memtableSwitchCount = CassandraMetricRegistry.get().counter(factory.createMetricName("MemtableSwitchCount"));
estimatedRowSizeHistogram = CassandraMetricRegistry.register(factory.createMetricName("EstimatedRowSizeHistogram"), new Gauge<long[]>()
memtableSwitchCount = Metrics.newCounter(factory.createMetricName("MemtableSwitchCount"));
estimatedRowSizeHistogram = Metrics.newGauge(factory.createMetricName("EstimatedRowSizeHistogram"), new Gauge<long[]>()
{
public long[] getValue()
public long[] value()
{
long[] histogram = new long[90];
for (SSTableReader sstable : cfs.getSSTables())
@ -128,9 +126,9 @@ public class ColumnFamilyMetrics
return histogram;
}
});
estimatedColumnCountHistogram = CassandraMetricRegistry.register(factory.createMetricName("EstimatedColumnCountHistogram"), new Gauge<long[]>()
estimatedColumnCountHistogram = Metrics.newGauge(factory.createMetricName("EstimatedColumnCountHistogram"), new Gauge<long[]>()
{
public long[] getValue()
public long[] value()
{
long[] histogram = new long[90];
for (SSTableReader sstable : cfs.getSSTables())
@ -142,10 +140,10 @@ public class ColumnFamilyMetrics
return histogram;
}
});
sstablesPerReadHistogram = CassandraMetricRegistry.get().histogram(factory.createMetricName("SSTablesPerReadHistogram"));
compressionRatio = CassandraMetricRegistry.register(factory.createMetricName("CompressionRatio"), new Gauge<Double>()
sstablesPerReadHistogram = Metrics.newHistogram(factory.createMetricName("SSTablesPerReadHistogram"));
compressionRatio = Metrics.newGauge(factory.createMetricName("CompressionRatio"), new Gauge<Double>()
{
public Double getValue()
public Double value()
{
double sum = 0;
int total = 0;
@ -162,26 +160,26 @@ public class ColumnFamilyMetrics
});
readLatency = new LatencyMetrics(factory, "Read");
writeLatency = new LatencyMetrics(factory, "Write");
pendingTasks = CassandraMetricRegistry.register(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
{
public Integer getValue()
public Integer value()
{
// TODO this actually isn't a good measure of pending tasks
return Keyspace.switchLock.getQueueLength();
}
});
liveSSTableCount = CassandraMetricRegistry.register(factory.createMetricName("LiveSSTableCount"), new Gauge<Integer>()
liveSSTableCount = Metrics.newGauge(factory.createMetricName("LiveSSTableCount"), new Gauge<Integer>()
{
public Integer getValue()
public Integer value()
{
return cfs.getDataTracker().getSSTables().size();
}
});
liveDiskSpaceUsed = CassandraMetricRegistry.get().counter(factory.createMetricName("LiveDiskSpaceUsed"));
totalDiskSpaceUsed = CassandraMetricRegistry.get().counter(factory.createMetricName("TotalDiskSpaceUsed"));
minRowSize = CassandraMetricRegistry.register(factory.createMetricName("MinRowSize"), new Gauge<Long>()
liveDiskSpaceUsed = Metrics.newCounter(factory.createMetricName("LiveDiskSpaceUsed"));
totalDiskSpaceUsed = Metrics.newCounter(factory.createMetricName("TotalDiskSpaceUsed"));
minRowSize = Metrics.newGauge(factory.createMetricName("MinRowSize"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long min = 0;
for (SSTableReader sstable : cfs.getSSTables())
@ -192,9 +190,9 @@ public class ColumnFamilyMetrics
return min;
}
});
maxRowSize = CassandraMetricRegistry.register(factory.createMetricName("MaxRowSize"), new Gauge<Long>()
maxRowSize = Metrics.newGauge(factory.createMetricName("MaxRowSize"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long max = 0;
for (SSTableReader sstable : cfs.getSSTables())
@ -205,9 +203,9 @@ public class ColumnFamilyMetrics
return max;
}
});
meanRowSize = CassandraMetricRegistry.register(factory.createMetricName("MeanRowSize"), new Gauge<Long>()
meanRowSize = Metrics.newGauge(factory.createMetricName("MeanRowSize"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long sum = 0;
long count = 0;
@ -219,9 +217,9 @@ public class ColumnFamilyMetrics
return count > 0 ? sum / count : 0;
}
});
bloomFilterFalsePositives = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterFalsePositives"), new Gauge<Long>()
bloomFilterFalsePositives = Metrics.newGauge(factory.createMetricName("BloomFilterFalsePositives"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long count = 0L;
for (SSTableReader sstable: cfs.getSSTables())
@ -229,9 +227,9 @@ public class ColumnFamilyMetrics
return count;
}
});
recentBloomFilterFalsePositives = CassandraMetricRegistry.register(factory.createMetricName("RecentBloomFilterFalsePositives"), new Gauge<Long>()
recentBloomFilterFalsePositives = Metrics.newGauge(factory.createMetricName("RecentBloomFilterFalsePositives"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long count = 0L;
for (SSTableReader sstable: cfs.getSSTables())
@ -239,9 +237,9 @@ public class ColumnFamilyMetrics
return count;
}
});
bloomFilterFalseRatio = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterFalseRatio"), new Gauge<Double>()
bloomFilterFalseRatio = Metrics.newGauge(factory.createMetricName("BloomFilterFalseRatio"), new Gauge<Double>()
{
public Double getValue()
public Double value()
{
long falseCount = 0L;
long trueCount = 0L;
@ -255,9 +253,9 @@ public class ColumnFamilyMetrics
return (double) falseCount / (trueCount + falseCount);
}
});
recentBloomFilterFalseRatio = CassandraMetricRegistry.register(factory.createMetricName("RecentBloomFilterFalseRatio"), new Gauge<Double>()
recentBloomFilterFalseRatio = Metrics.newGauge(factory.createMetricName("RecentBloomFilterFalseRatio"), new Gauge<Double>()
{
public Double getValue()
public Double value()
{
long falseCount = 0L;
long trueCount = 0L;
@ -271,9 +269,9 @@ public class ColumnFamilyMetrics
return (double) falseCount / (trueCount + falseCount);
}
});
bloomFilterDiskSpaceUsed = CassandraMetricRegistry.register(factory.createMetricName("BloomFilterDiskSpaceUsed"), new Gauge<Long>()
bloomFilterDiskSpaceUsed = Metrics.newGauge(factory.createMetricName("BloomFilterDiskSpaceUsed"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
long total = 0;
for (SSTableReader sst : cfs.getSSTables())
@ -281,9 +279,8 @@ public class ColumnFamilyMetrics
return total;
}
});
speculativeRetry = CassandraMetricRegistry.get().counter(factory.createMetricName("SpeculativeRetry"));
keyCacheHitRate = CassandraMetricRegistry.register(factory.createMetricName("KeyCacheHitRate"), new RatioGauge()
speculativeRetry = Metrics.newCounter(factory.createMetricName("SpeculativeRetry"));
keyCacheHitRate = Metrics.newGauge(factory.createMetricName("KeyCacheHitRate"), new RatioGauge()
{
protected double getNumerator()
{
@ -300,19 +297,8 @@ 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)
{
@ -328,27 +314,27 @@ public class ColumnFamilyMetrics
{
readLatency.release();
writeLatency.release();
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"));
CassandraMetricRegistry.unregister(factory.createMetricName("KeyCacheHitRate"));
CassandraMetricRegistry.unregister(factory.createMetricName("SpeculativeRetry"));
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"));
Metrics.defaultRegistry().removeMetric(factory.createMetricName("KeyCacheHitRate"));
Metrics.defaultRegistry().removeMetric(factory.createMetricName("SpeculativeRetry"));
}
class ColumnFamilyMetricNameFactory implements MetricNameFactory
@ -364,7 +350,7 @@ public class ColumnFamilyMetrics
isIndex = cfs.isIndex();
}
public String createMetricName(String metricName)
public MetricName createMetricName(String metricName)
{
String groupName = ColumnFamilyMetrics.class.getPackage().getName();
String type = isIndex ? "IndexColumnFamily" : "ColumnFamily";
@ -376,7 +362,7 @@ public class ColumnFamilyMetrics
mbeanName.append(",scope=").append(columnFamilyName);
mbeanName.append(",name=").append(metricName);
return MetricRegistry.name(groupName, type, metricName, keyspaceName + "." + columnFamilyName, mbeanName.toString());
return new MetricName(groupName, type, metricName, keyspaceName + "." + columnFamilyName, mbeanName.toString());
}
}
}

View File

@ -17,8 +17,9 @@
*/
package org.apache.cassandra.metrics;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Gauge;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Gauge;
import com.yammer.metrics.core.MetricName;
import org.apache.cassandra.db.commitlog.CommitLogAllocator;
import org.apache.cassandra.db.commitlog.ICommitLogExecutorService;
@ -40,23 +41,23 @@ public class CommitLogMetrics
public CommitLogMetrics(final ICommitLogExecutorService executor, final CommitLogAllocator allocator)
{
completedTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
completedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return executor.getCompletedTasks();
}
});
pendingTasks = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Long>()
pendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return executor.getPendingTasks();
}
});
totalCommitLogSize = CassandraMetricRegistry.register(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "TotalCommitLogSize"), new Gauge<Long>()
totalCommitLogSize = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "TotalCommitLogSize"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return allocator.bytesUsed();
}

View File

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

View File

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

View File

@ -17,8 +17,11 @@
*/
package org.apache.cassandra.metrics;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Meter;
import java.util.concurrent.TimeUnit;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Meter;
import com.yammer.metrics.core.MetricName;
import org.apache.cassandra.net.MessagingService;
@ -37,13 +40,13 @@ public class DroppedMessageMetrics
public DroppedMessageMetrics(MessagingService.Verb verb)
{
dropped = CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Dropped", verb.toString()));
dropped = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Dropped", verb.toString()), "dropped", TimeUnit.SECONDS);
}
@Deprecated
public int getRecentlyDropped()
{
long currentDropped = dropped.getCount();
long currentDropped = dropped.count();
long recentlyDropped = currentDropped - lastDropped;
lastDropped = currentDropped;
return (int)recentlyDropped;

View File

@ -29,8 +29,9 @@ import org.slf4j.LoggerFactory;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Counter;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
import com.yammer.metrics.core.MetricName;
/**
* Metrics for {@link HintedHandOffManager}.
@ -56,7 +57,7 @@ public class HintedHandoffMetrics
{
public Counter load(InetAddress address)
{
return CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Hints_created-" + address.getHostAddress()));
return Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "Hints_created-" + address.getHostAddress()));
}
});
@ -89,12 +90,12 @@ public class HintedHandoffMetrics
public DifferencingCounter(InetAddress address)
{
this.meter = CassandraMetricRegistry.get().counter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Hints_not_stored-" + address.getHostAddress()));
this.meter = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "Hints_not_stored-" + address.getHostAddress()));
}
public long diffrence()
{
long current = meter.getCount();
long current = meter.count();
long diffrence = current - reported;
this.reported = current;
return diffrence;
@ -102,7 +103,7 @@ public class HintedHandoffMetrics
public long count()
{
return meter.getCount();
return meter.count();
}
public void mark()

View File

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

View File

@ -17,6 +17,8 @@
*/
package org.apache.cassandra.metrics;
import com.yammer.metrics.core.MetricName;
public interface MetricNameFactory
{
/**
@ -25,5 +27,5 @@ public interface MetricNameFactory
* @param metricName part of qualified name.
* @return new String with given metric name.
*/
String createMetricName(String metricName);
MetricName createMetricName(String metricName);
}

View File

@ -20,8 +20,12 @@ package org.apache.cassandra.metrics;
*
*/
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Meter;
import java.util.concurrent.TimeUnit;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Meter;
import com.yammer.metrics.core.MetricName;
/**
* Metrics related to Read Repair.
@ -31,9 +35,9 @@ public class ReadRepairMetrics {
public static final String TYPE_NAME = "ReadRepair";
public static final Meter repairedBlocking =
CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "RepairedBlocking"));
Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "RepairedBlocking"), "RepairedBlocking", TimeUnit.SECONDS);
public static final Meter repairedBackground =
CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "RepairedBackground"));
Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "RepairedBackground"), "RepairedBackground", TimeUnit.SECONDS);
public static final Meter attempted =
CassandraMetricRegistry.get().meter(MetricRegistry.name(GROUP_NAME, TYPE_NAME, "Attempted"));
Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "Attempted"), "Attempted", TimeUnit.SECONDS);
}

View File

@ -17,13 +17,14 @@
*/
package org.apache.cassandra.metrics;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Counter;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
import com.yammer.metrics.core.MetricName;
/**
* Metrics related to Storage.
*/
public class StorageMetrics
{
public static final Counter load = CassandraMetricRegistry.get().counter(MetricRegistry.name("org.apache.cassandra.metrics", "Storage", "Load"));
public static final Counter load = Metrics.newCounter(new MetricName("org.apache.cassandra.metrics", "Storage", "Load"));
}

View File

@ -20,8 +20,9 @@ package org.apache.cassandra.metrics;
import java.net.InetAddress;
import java.util.concurrent.ConcurrentMap;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Counter;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
import com.yammer.metrics.core.MetricName;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
/**
@ -34,9 +35,9 @@ public class StreamingMetrics
private static final ConcurrentMap<InetAddress, StreamingMetrics> instances = new NonBlockingHashMap<InetAddress, StreamingMetrics>();
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 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 final Counter incomingBytes;
public final Counter outgoingBytes;
@ -53,7 +54,7 @@ public class StreamingMetrics
public StreamingMetrics(final InetAddress peer)
{
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(":", ".")));
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(":", ".")));
}
}

View File

@ -19,8 +19,8 @@ package org.apache.cassandra.metrics;
import java.util.concurrent.ThreadPoolExecutor;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.*;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.*;
/**
* Metrics for {@link ThreadPoolExecutor}.
@ -54,25 +54,25 @@ public class ThreadPoolMetrics
{
this.factory = new ThreadPoolMetricNameFactory(path, poolName);
activeTasks = CassandraMetricRegistry.register(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
{
public Integer getValue()
public Integer value()
{
return executor.getActiveCount();
}
});
totalBlocked = CassandraMetricRegistry.get().counter(factory.createMetricName("TotalBlockedTasks"));
currentBlocked = CassandraMetricRegistry.get().counter(factory.createMetricName("CurrentlyBlockedTasks"));
completedTasks = CassandraMetricRegistry.register(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks"));
currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks"));
completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return executor.getCompletedTaskCount();
}
});
pendingTasks = CassandraMetricRegistry.register(factory.createMetricName("PendingTasks"), new Gauge<Long>()
pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
{
public Long getValue()
public Long value()
{
return executor.getTaskCount() - executor.getCompletedTaskCount();
}
@ -81,11 +81,11 @@ public class ThreadPoolMetrics
public void release()
{
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"));
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"));
}
class ThreadPoolMetricNameFactory implements MetricNameFactory
@ -99,7 +99,7 @@ public class ThreadPoolMetrics
this.poolName = poolName;
}
public String createMetricName(String metricName)
public MetricName 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 MetricRegistry.name(groupName, type, metricName, path + "." + poolName, mbeanName.toString());
return new MetricName(groupName, type, metricName, path + "." + poolName, mbeanName.toString());
}
}
}

View File

@ -783,7 +783,7 @@ public final class MessagingService implements MessagingServiceMBean
boolean logTpstats = false;
for (Map.Entry<Verb, DroppedMessageMetrics> entry : droppedMessages.entrySet())
{
int dropped = (int) entry.getValue().dropped.getCount();
int dropped = (int) entry.getValue().dropped.count();
Verb verb = entry.getKey();
int recent = dropped - lastDroppedInternal.get(verb);
if (recent > 0)
@ -920,7 +920,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.getCount());
map.put(entry.getKey().toString(), (int) entry.getValue().dropped.count());
return map;
}
@ -934,7 +934,7 @@ public final class MessagingService implements MessagingServiceMBean
public long getTotalTimeouts()
{
return ConnectionMetrics.totalTimeouts.getCount();
return ConnectionMetrics.totalTimeouts.count();
}
public long getRecentTotalTimouts()

View File

@ -101,7 +101,7 @@ public class OutboundTcpConnectionPool
public long getTimeouts()
{
return metrics.timeouts.getCount();
return metrics.timeouts.count();
}
public long getRecentTimeouts()

View File

@ -90,12 +90,12 @@ class WeightedQueue implements WeightedQueueMBean
public long getOperations()
{
return metric.latency.getCount();
return metric.latency.count();
}
public long getTotalLatencyMicros()
{
return metric.totalLatency.getCount();
return metric.totalLatency.count();
}
public double getRecentLatencyMicros()

View File

@ -151,22 +151,22 @@ public class CacheService implements CacheServiceMBean
public long getKeyCacheHits()
{
return keyCache.getMetrics().hits.getCount();
return keyCache.getMetrics().hits.count();
}
public long getRowCacheHits()
{
return rowCache.getMetrics().hits.getCount();
return rowCache.getMetrics().hits.count();
}
public long getKeyCacheRequests()
{
return keyCache.getMetrics().requests.getCount();
return keyCache.getMetrics().requests.count();
}
public long getRowCacheRequests()
{
return rowCache.getMetrics().requests.getCount();
return rowCache.getMetrics().requests.count();
}
public double getKeyCacheRecentHitRate()
@ -219,7 +219,7 @@ public class CacheService implements CacheServiceMBean
public long getRowCacheCapacityInBytes()
{
return rowCache.getMetrics().capacity.getValue();
return rowCache.getMetrics().capacity.value();
}
public long getRowCacheCapacityInMB()
@ -237,7 +237,7 @@ public class CacheService implements CacheServiceMBean
public long getKeyCacheCapacityInBytes()
{
return keyCache.getMetrics().capacity.getValue();
return keyCache.getMetrics().capacity.value();
}
public long getKeyCacheCapacityInMB()
@ -255,7 +255,7 @@ public class CacheService implements CacheServiceMBean
public long getRowCacheSize()
{
return rowCache.getMetrics().size.getValue();
return rowCache.getMetrics().size.value();
}
public long getRowCacheEntries()
@ -265,7 +265,7 @@ public class CacheService implements CacheServiceMBean
public long getKeyCacheSize()
{
return keyCache.getMetrics().size.getValue();
return keyCache.getMetrics().size.value();
}
public long getKeyCacheEntries()

View File

@ -1673,12 +1673,12 @@ public class StorageProxy implements StorageProxyMBean
public long getReadOperations()
{
return readMetrics.latency.getCount();
return readMetrics.latency.count();
}
public long getTotalReadLatencyMicros()
{
return readMetrics.totalLatency.getCount();
return readMetrics.totalLatency.count();
}
public double getRecentReadLatencyMicros()
@ -1698,12 +1698,12 @@ public class StorageProxy implements StorageProxyMBean
public long getRangeOperations()
{
return rangeMetrics.latency.getCount();
return rangeMetrics.latency.count();
}
public long getTotalRangeLatencyMicros()
{
return rangeMetrics.totalLatency.getCount();
return rangeMetrics.totalLatency.count();
}
public double getRecentRangeLatencyMicros()
@ -1723,12 +1723,12 @@ public class StorageProxy implements StorageProxyMBean
public long getWriteOperations()
{
return writeMetrics.latency.getCount();
return writeMetrics.latency.count();
}
public long getTotalWriteLatencyMicros()
{
return writeMetrics.totalLatency.getCount();
return writeMetrics.totalLatency.count();
}
public double getRecentWriteLatencyMicros()
@ -1993,14 +1993,14 @@ public class StorageProxy implements StorageProxyMBean
public long getReadRepairAttempted() {
return ReadRepairMetrics.attempted.getCount();
return ReadRepairMetrics.attempted.count();
}
public long getReadRepairRepairedBlocking() {
return ReadRepairMetrics.repairedBlocking.getCount();
return ReadRepairMetrics.repairedBlocking.count();
}
public long getReadRepairRepairedBackground() {
return ReadRepairMetrics.repairedBackground.getCount();
return ReadRepairMetrics.repairedBackground.count();
}
}

View File

@ -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.getSnapshot().getMax(), 5, 0.1);
assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 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.getSnapshot().getMax(), 5, 0.1);
assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 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.getSnapshot().getMax(), 5, 0.1);
assertEquals(cfStore.metric.sstablesPerReadHistogram.max(), 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.getSnapshot().getMax(), 0.1);
assertEquals(2, cfs.metric.sstablesPerReadHistogram.max(), 0.1);
}
private void validateSliceLarge(ColumnFamilyStore cfStore) throws IOException

View File

@ -85,7 +85,7 @@ public class RowIterationTest extends SchemaLoader
rm.apply();
store.forceBlockingFlush();
ColumnFamily cf = Util.getRangeSlice(store).get(0).cf;
ColumnFamily cf = Util.getRangeSlice(store).iterator().next().cf;
assert cf.deletionInfo().equals(delInfo2);
}

View File

@ -17,24 +17,17 @@
*/
package org.apache.cassandra.stress;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.Serializable;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.cli.*;
import org.apache.commons.lang3.StringUtils;
import com.yammer.metrics.Metrics;
import org.apache.cassandra.cli.transport.FramedTransportFactory;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.EncryptionOptions;
@ -43,18 +36,14 @@ import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.db.marshal.*;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.metrics.CassandraMetricRegistry;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.thrift.*;
import org.apache.cassandra.transport.SimpleClient;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.commons.cli.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportFactory;
import com.codahale.metrics.MetricRegistry;
public class Session implements Serializable
{
@ -69,7 +58,7 @@ public class Session implements Serializable
public final AtomicInteger operations = new AtomicInteger();
public final AtomicInteger keys = new AtomicInteger();
public final com.codahale.metrics.Timer latency = CassandraMetricRegistry.get().timer(MetricRegistry.name(Session.class, "latency"));
public final com.yammer.metrics.core.Timer latency = Metrics.newTimer(Session.class, "latency");
private static final String SSL_TRUSTSTORE = "truststore";
private static final String SSL_TRUSTSTORE_PW = "truststore-password";

View File

@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
import com.google.common.util.concurrent.Uninterruptibles;
import com.google.common.util.concurrent.RateLimiter;
import com.codahale.metrics.Snapshot;
import com.yammer.metrics.stats.Snapshot;
import org.apache.cassandra.stress.operations.*;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;

View File

@ -22,7 +22,8 @@ import java.io.PrintStream;
import org.apache.commons.lang3.time.DurationFormatUtils;
import com.codahale.metrics.Snapshot;
import com.yammer.metrics.stats.Snapshot;
/**
* Gathers and aggregates statistics for an operation

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -71,7 +71,7 @@ public class CounterAdder extends Operation
? getSuperColumnsMutationMap(superColumns)
: getColumnsMutationMap(columns));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,21 +17,16 @@
*/
package org.apache.cassandra.stress.operations;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import org.apache.cassandra.db.ColumnFamilyType;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
import org.apache.cassandra.thrift.ColumnParent;
import org.apache.cassandra.thrift.SlicePredicate;
import org.apache.cassandra.thrift.SliceRange;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.thrift.*;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
public class CounterGetter extends Operation
{
@ -73,7 +68,7 @@ public class CounterGetter extends Operation
String superColumn = 'S' + Integer.toString(j);
ColumnParent parent = new ColumnParent("SuperCounter1").setSuper_column(superColumn.getBytes());
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;
@ -118,7 +113,7 @@ public class CounterGetter extends Operation
byte[] key = generateKey();
ByteBuffer keyBuffer = ByteBuffer.wrap(key);
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
@ -75,7 +75,7 @@ public class CqlCounterAdder extends CQLOperation
String key = String.format("%0" + session.getTotalKeysLength() + "d", index);
List<String> queryParams = Collections.singletonList(getUnQuotedCqlBlob(key, session.cqlVersion.startsWith("3")));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
@ -73,7 +73,7 @@ public class CqlCounterGetter extends CQLOperation
byte[] key = generateKey();
List<String> queryParams = Collections.singletonList(getUnQuotedCqlBlob(key, session.cqlVersion.startsWith("3")));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.cql3.ResultSet;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
@ -86,7 +86,7 @@ public class CqlIndexedRangeSlicer extends CQLOperation
while (received < expectedPerValue)
{
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
@ -98,7 +98,7 @@ public class CqlInserter extends CQLOperation
String key = String.format("%0" + session.getTotalKeysLength() + "d", index);
queryParms.add(getUnQuotedCqlBlob(key, session.cqlVersion.startsWith("3")));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.db.ColumnFamilyType;
@ -67,7 +67,7 @@ public class CqlRangeSlicer extends CQLOperation
String key = String.format("%0" + session.getTotalKeysLength() + "d", index);
List<String> queryParams = Collections.singletonList(getUnQuotedCqlBlob(key, session.cqlVersion.startsWith("3")));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
@ -88,7 +88,7 @@ public class CqlReader extends CQLOperation
byte[] key = generateKey();
queryParams.add(getUnQuotedCqlBlob(key, session.cqlVersion.startsWith("3")));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -67,7 +67,7 @@ public class IndexedRangeSlicer extends Operation
session.getKeysPerCall());
List<KeySlice> results = null;
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -74,7 +74,7 @@ public class Inserter extends Operation
: getColumnsMutationMap(columns);
Map<ByteBuffer, Map<String, List<Mutation>>> record = Collections.singletonMap(ByteBufferUtil.bytes(rawKey), row);
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -56,7 +56,7 @@ public class MultiGetter extends Operation
{
ColumnParent parent = new ColumnParent("Super1").setSuper_column(ByteBufferUtil.bytes("S" + j));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;
@ -99,7 +99,7 @@ public class MultiGetter extends Operation
List<ByteBuffer> keys = generateKeys(offset, offset + session.getKeysPerCall());
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -62,7 +62,7 @@ public class RangeSlicer extends Operation
String superColumnName = "S" + Integer.toString(i);
ColumnParent parent = new ColumnParent("Super1").setSuper_column(ByteBufferUtil.bytes(superColumnName));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;
@ -105,7 +105,7 @@ public class RangeSlicer extends Operation
List<KeySlice> slices = new ArrayList<KeySlice>();
KeyRange range = new KeyRange(count).setStart_key(start).setEnd_key(ByteBufferUtil.EMPTY_BYTE_BUFFER);
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;

View File

@ -17,7 +17,7 @@
*/
package org.apache.cassandra.stress.operations;
import com.codahale.metrics.Timer.Context;
import com.yammer.metrics.core.TimerContext;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
@ -67,7 +67,7 @@ public class Reader extends Operation
String superColumn = 'S' + Integer.toString(j);
ColumnParent parent = new ColumnParent("Super1").setSuper_column(superColumn.getBytes(UTF_8));
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;
@ -112,7 +112,7 @@ public class Reader extends Operation
byte[] key = generateKey();
ByteBuffer keyBuffer = ByteBuffer.wrap(key);
Context context = session.latency.time();
TimerContext context = session.latency.time();
boolean success = false;
String exceptionMessage = null;