mirror of https://github.com/apache/cassandra
update metrics-core to 3.0.1
patch by dbrosius reviewed by jbellis for cassandra-5838
This commit is contained in:
parent
9bc8fa2a19
commit
c27a161920
|
|
@ -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"/>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(":", ".")));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class OutboundTcpConnectionPool
|
|||
|
||||
public long getTimeouts()
|
||||
{
|
||||
return metrics.timeouts.count();
|
||||
return metrics.timeouts.getCount();
|
||||
}
|
||||
|
||||
public long getRecentTimeouts()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -17,30 +17,41 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress;
|
||||
|
||||
import java.io.*;
|
||||
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.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.yammer.metrics.Metrics;
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
|
||||
import org.apache.cassandra.cli.transport.FramedTransportFactory;
|
||||
import org.apache.cassandra.config.CFMetaData;
|
||||
import org.apache.cassandra.config.EncryptionOptions;
|
||||
import org.apache.cassandra.config.EncryptionOptions.ClientEncryptionOptions;
|
||||
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.db.marshal.*;
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import org.apache.cassandra.db.ColumnFamilyType;
|
||||
import org.apache.cassandra.metrics.CassandraMetricRegistry;
|
||||
import org.apache.cassandra.stress.util.CassandraClient;
|
||||
import org.apache.cassandra.transport.SimpleClient;
|
||||
import org.apache.cassandra.thrift.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import org.apache.cassandra.transport.SimpleClient;
|
||||
import org.apache.cassandra.utils.ByteBufferUtil;
|
||||
import org.apache.commons.cli.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.thrift.protocol.TBinaryProtocol;
|
||||
import org.apache.thrift.transport.TSocket;
|
||||
import org.apache.thrift.transport.TTransport;
|
||||
|
|
@ -59,7 +70,7 @@ public class Session implements Serializable
|
|||
|
||||
public final AtomicInteger operations = new AtomicInteger();
|
||||
public final AtomicInteger keys = new AtomicInteger();
|
||||
public final com.yammer.metrics.core.Timer latency = Metrics.newTimer(Session.class, "latency");
|
||||
public final com.codahale.metrics.Timer latency = CassandraMetricRegistry.get().timer(MetricRegistry.name(Session.class, "latency"));
|
||||
|
||||
private static final String SSL_TRUSTSTORE = "truststore";
|
||||
private static final String SSL_TRUSTSTORE_PW = "truststore-password";
|
||||
|
|
|
|||
|
|
@ -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.yammer.metrics.stats.Snapshot;
|
||||
import com.codahale.metrics.Snapshot;
|
||||
import org.apache.cassandra.stress.operations.*;
|
||||
import org.apache.cassandra.stress.util.CassandraClient;
|
||||
import org.apache.cassandra.stress.util.Operation;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package org.apache.cassandra.stress;
|
||||
|
||||
import com.yammer.metrics.stats.Snapshot;
|
||||
import com.codahale.metrics.Snapshot;
|
||||
import java.io.PrintStream;
|
||||
import org.apache.commons.lang.time.DurationFormatUtils;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,17 +17,22 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
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.db.ColumnFamilyType;
|
||||
import org.apache.cassandra.thrift.*;
|
||||
|
||||
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 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;
|
||||
|
||||
public class CounterGetter extends Operation
|
||||
{
|
||||
public CounterGetter(Session client, int index)
|
||||
|
|
@ -68,7 +73,7 @@ public class CounterGetter extends Operation
|
|||
String superColumn = 'S' + Integer.toString(j);
|
||||
ColumnParent parent = new ColumnParent("SuperCounter1").setSuper_column(superColumn.getBytes());
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
@ -113,7 +118,7 @@ public class CounterGetter extends Operation
|
|||
byte[] key = generateKey();
|
||||
ByteBuffer keyBuffer = ByteBuffer.wrap(key);
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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")));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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")));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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)
|
||||
{
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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")));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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")));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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")));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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;
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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);
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context 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());
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context 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);
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.cassandra.stress.operations;
|
||||
|
||||
import com.yammer.metrics.core.TimerContext;
|
||||
import com.codahale.metrics.Timer.Context;
|
||||
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));
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context 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);
|
||||
|
||||
TimerContext context = session.latency.time();
|
||||
Context context = session.latency.time();
|
||||
|
||||
boolean success = false;
|
||||
String exceptionMessage = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue