From 46ba60f10fe7db08fdafa3f21827f9325de2f129 Mon Sep 17 00:00:00 2001 From: Charles Allen Date: Tue, 22 Sep 2015 11:13:47 -0700 Subject: [PATCH 1/2] Enable logging for memcached in factory --- server/src/main/java/io/druid/client/cache/MemcachedCache.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main/java/io/druid/client/cache/MemcachedCache.java b/server/src/main/java/io/druid/client/cache/MemcachedCache.java index dec2c3e4979..0ef1093288a 100644 --- a/server/src/main/java/io/druid/client/cache/MemcachedCache.java +++ b/server/src/main/java/io/druid/client/cache/MemcachedCache.java @@ -46,6 +46,7 @@ import net.spy.memcached.MemcachedClient; import net.spy.memcached.MemcachedClientIF; import net.spy.memcached.internal.BulkFuture; import net.spy.memcached.metrics.MetricCollector; +import net.spy.memcached.metrics.MetricType; import net.spy.memcached.ops.LinkedOperationQueueFactory; import net.spy.memcached.ops.OperationQueueFactory; import org.apache.commons.codec.digest.DigestUtils; @@ -344,6 +345,7 @@ public class MemcachedCache implements Cache .setReadBufferSize(config.getReadBufferSize()) .setOpQueueFactory(opQueueFactory) .setMetricCollector(metricCollector) + .setEnableMetrics(MetricType.DEBUG) // Not as scary as it sounds .build(); final List hosts = AddrUtil.getAddresses(config.getHosts()); From 4308aa93e23538a3247ec7dd8b2792292e59387e Mon Sep 17 00:00:00 2001 From: Charles Allen Date: Tue, 22 Sep 2015 12:50:54 -0700 Subject: [PATCH 2/2] Add meter metrics for memcached --- server/src/main/java/io/druid/client/cache/MemcachedCache.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/main/java/io/druid/client/cache/MemcachedCache.java b/server/src/main/java/io/druid/client/cache/MemcachedCache.java index 0ef1093288a..472be53904f 100644 --- a/server/src/main/java/io/druid/client/cache/MemcachedCache.java +++ b/server/src/main/java/io/druid/client/cache/MemcachedCache.java @@ -134,6 +134,9 @@ public class MemcachedCache implements Cache for (Map.Entry entry : counters.entrySet()) { builder.put(entry.getKey(), entry.getValue().get()); } + for (Map.Entry entry : meters.entrySet()) { + builder.put(entry.getKey(), entry.getValue().get()); + } return builder.build(); } };