From 392765fa2ea07b697b0d4c886c843eeb51113103 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Thu, 22 Oct 2015 10:43:29 +0300 Subject: [PATCH 1/2] StorageProxy: Add depricated method implementation based on metrics This follow origin by adding the implementation for the depricated metrics methods. Similiar to origin, the implementation calls the implementation in the metrics. Signed-off-by: Amnon Heiman --- .../org/apache/cassandra/service/StorageProxy.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/cassandra/service/StorageProxy.java b/src/main/java/org/apache/cassandra/service/StorageProxy.java index 70ca247..9465c8a 100644 --- a/src/main/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/main/java/org/apache/cassandra/service/StorageProxy.java @@ -113,7 +113,7 @@ public class StorageProxy implements StorageProxyMBean { @Deprecated public long[] getTotalReadLatencyHistogramMicros() { log(" getTotalReadLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return readMetrics.totalLatencyHistogram.getBuckets(false); } /** @@ -122,7 +122,7 @@ public class StorageProxy implements StorageProxyMBean { @Deprecated public long[] getRecentReadLatencyHistogramMicros() { log(" getRecentReadLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return readMetrics.getRecentLatencyHistogram(); } @Deprecated @@ -146,13 +146,13 @@ public class StorageProxy implements StorageProxyMBean { @Deprecated public long[] getTotalRangeLatencyHistogramMicros() { log(" getTotalRangeLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return rangeMetrics.totalLatencyHistogram.getBuckets(false); } @Deprecated public long[] getRecentRangeLatencyHistogramMicros() { log(" getRecentRangeLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return rangeMetrics.getRecentLatencyHistogram(); } @Deprecated @@ -176,13 +176,13 @@ public class StorageProxy implements StorageProxyMBean { @Deprecated public long[] getTotalWriteLatencyHistogramMicros() { log(" getTotalWriteLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return writeMetrics.totalLatencyHistogram.getBuckets(false); } @Deprecated public long[] getRecentWriteLatencyHistogramMicros() { log(" getRecentWriteLatencyHistogramMicros()"); - return c.getLongArrValue(""); + return writeMetrics.getRecentLatencyHistogram(); } public long getTotalHints() { From ae2622633944047cd353793e4e16d3e927aba541 Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Sun, 25 Oct 2015 13:36:10 +0200 Subject: [PATCH 2/2] ClientRequestMetrics: pass the url similiar to LatencyMetrics In LatencyMetrics the URL is passed without the ending slash, this patch use the same notation in ClientRequestMetrics. Signed-off-by: Amnon Heiman --- .../apache/cassandra/metrics/ClientRequestMetrics.java | 4 ++-- .../org/apache/cassandra/service/StorageProxy.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/cassandra/metrics/ClientRequestMetrics.java b/src/main/java/org/apache/cassandra/metrics/ClientRequestMetrics.java index 30054d3..ff25ce2 100644 --- a/src/main/java/org/apache/cassandra/metrics/ClientRequestMetrics.java +++ b/src/main/java/org/apache/cassandra/metrics/ClientRequestMetrics.java @@ -59,10 +59,10 @@ public class ClientRequestMetrics extends LatencyMetrics { public ClientRequestMetrics(String url, String scope) { super(url, "ClientRequest", scope); - timeouts = APIMetrics.newMeter(url + "timeouts", + timeouts = APIMetrics.newMeter(url + "/timeouts", factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS); - unavailables = APIMetrics.newMeter(url + "unavailables", + unavailables = APIMetrics.newMeter(url + "/unavailables", factory.createMetricName("Unavailables"), "unavailables", TimeUnit.SECONDS); } diff --git a/src/main/java/org/apache/cassandra/service/StorageProxy.java b/src/main/java/org/apache/cassandra/service/StorageProxy.java index 9465c8a..8397fa5 100644 --- a/src/main/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/main/java/org/apache/cassandra/service/StorageProxy.java @@ -55,15 +55,15 @@ public class StorageProxy implements StorageProxyMBean { public static final String UNREACHABLE = "UNREACHABLE"; private static final ClientRequestMetrics readMetrics = new ClientRequestMetrics( - "storage_proxy/metrics/read/", "Read"); + "storage_proxy/metrics/read", "Read"); private static final ClientRequestMetrics rangeMetrics = new ClientRequestMetrics( - "storage_proxy/metrics/range/", "RangeSlice"); + "storage_proxy/metrics/range", "RangeSlice"); private static final ClientRequestMetrics writeMetrics = new ClientRequestMetrics( - "storage_proxy/metrics/write/", "Write"); + "storage_proxy/metrics/write", "Write"); private static final CASClientRequestMetrics casWriteMetrics = new CASClientRequestMetrics( - "storage_proxy/metrics/cas_write/", "CASWrite"); + "storage_proxy/metrics/cas_write", "CASWrite"); private static final CASClientRequestMetrics casReadMetrics = new CASClientRequestMetrics( - "storage_proxy/metrics/cas_read/", "CASRead"); + "storage_proxy/metrics/cas_read", "CASRead"); private static final double CONCURRENT_SUBREQUESTS_MARGIN = 0.10;