incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/3] git commit: More metrics updates, I think that everything is using the metrics lib.
Date Wed, 06 Mar 2013 16:29:03 GMT
More metrics updates, I think that everything is using the metrics lib.


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

Branch: refs/heads/0.2-dev
Commit: f3a69cb142a4a7217b6bd98c81e0a92c6a398010
Parents: cb00128
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Wed Mar 6 11:18:46 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Mar 6 11:18:46 2013 -0500

----------------------------------------------------------------------
 .../indexserver/DistributedIndexServer.java        |   34 +-
 .../java/org/apache/blur/server/BlurServer.java    |   34 +-
 .../org/apache/blur/thrift/ThriftBlurServer.java   |   10 +-
 .../main/java/org/apache/blur/utils/BlurUtil.java  |   29 +-
 .../java/org/apache/blur/gui/HttpJettyServer.java  |    6 +-
 .../org/apache/blur/gui/LiveMetricsServlet.java    |   60 ++--
 .../org/apache/blur/store/buffer/BufferStore.java  |   48 ++-
 .../org/apache/blur/store/hdfs/HdfsDirectory.java  |   14 +-
 .../org/apache/blur/metrics/AtomicLongGauge.java   |   24 +
 .../java/org/apache/blur/metrics/BlurMetrics.java  |  192 ++++----
 .../java/org/apache/blur/metrics/HeapMetrics.java  |  156 ++++----
 .../org/apache/blur/metrics/MetricsConstants.java  |   20 +
 .../java/org/apache/blur/metrics/QueryMetrics.java |  346 ++++++++-------
 13 files changed, 530 insertions(+), 443 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java b/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
index 3c0984b..1429b9b 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
@@ -16,6 +16,9 @@ package org.apache.blur.manager.indexserver;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.apache.blur.metrics.MetricsConstants.BLUR;
+import static org.apache.blur.metrics.MetricsConstants.LUCENE;
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
 import static org.apache.blur.utils.BlurConstants.SHARD_PREFIX;
 
 import java.io.IOException;
@@ -52,6 +55,7 @@ import org.apache.blur.manager.writer.BlurIndexReader;
 import org.apache.blur.manager.writer.BlurIndexRefresher;
 import org.apache.blur.manager.writer.BlurNRTIndex;
 import org.apache.blur.manager.writer.SharedMergeScheduler;
+import org.apache.blur.metrics.AtomicLongGauge;
 import org.apache.blur.metrics.BlurMetrics;
 import org.apache.blur.server.ShardContext;
 import org.apache.blur.server.TableContext;
@@ -77,6 +81,9 @@ import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
 
+import com.yammer.metrics.Metrics;
+import com.yammer.metrics.core.MetricName;
+
 public class DistributedIndexServer extends AbstractIndexServer {
 
   private static final Log LOG = LogFactory.getLog(DistributedIndexServer.class);
@@ -112,6 +119,10 @@ public class DistributedIndexServer extends AbstractIndexServer {
   private SharedMergeScheduler _mergeScheduler;
   private IndexInputCloser _closer;
   private Cache _cache;
+  private AtomicLong _tableCount = new AtomicLong();
+  private AtomicLong _segmentCount = new AtomicLong();
+  private AtomicLong _indexMemoryUsage = new AtomicLong();
+  private AtomicLong _indexCount = new AtomicLong();
 
   public static interface ReleaseReader {
     void release() throws IOException;
@@ -137,6 +148,11 @@ public class DistributedIndexServer extends AbstractIndexServer {
     _running.set(true);
     setupTableWarmer();
     watchForShardServerChanges();
+
+    Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, BLUR, "Table Count"), AtomicLongGauge.wrap(_tableCount));
+    Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, LUCENE, "Segment Count"), AtomicLongGauge.wrap(_segmentCount));
+    Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, LUCENE, "Index Memory Usage (Bytes)"), AtomicLongGauge.wrap(_indexMemoryUsage));
+    Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, LUCENE, "Index Count"), AtomicLongGauge.wrap(_indexCount));
   }
 
   private void watchForShardServerChanges() {
@@ -224,9 +240,10 @@ public class DistributedIndexServer extends AbstractIndexServer {
       private void warmup() {
         if (_running.get()) {
           LOG.debug("Running warmup.");
-          List<String> tableList = _clusterStatus.getTableList(false);
-          _blurMetrics.tableCount.set(tableList.size());
-          long indexCount = 0;
+          final List<String> tableList = _clusterStatus.getTableList(false);
+          _tableCount.set(tableList.size());
+
+          int indexCount = 0;
           AtomicLong segmentCount = new AtomicLong();
           AtomicLong indexMemoryUsage = new AtomicLong();
           for (String table : tableList) {
@@ -242,9 +259,9 @@ public class DistributedIndexServer extends AbstractIndexServer {
               LOG.error("Unknown error trying to warm table [{0}]", e, table);
             }
           }
-          _blurMetrics.indexCount.set(indexCount);
-          _blurMetrics.segmentCount.set(segmentCount.get());
-          _blurMetrics.indexMemoryUsage.set(indexMemoryUsage.get());
+          _indexCount.set(indexCount);
+          _segmentCount.set(segmentCount.get());
+          _indexMemoryUsage.set(indexMemoryUsage.get());
         }
       }
 
@@ -459,8 +476,8 @@ public class DistributedIndexServer extends AbstractIndexServer {
     directory.setLockFactory(lockFactory);
     Directory dir = new BlockDirectory(table + "_" + shard, directory, _cache);
 
-//    Directory dir = shardContext.getDirectory();
-//    dir.setLockFactory(lockFactory);
+    // Directory dir = shardContext.getDirectory();
+    // dir.setLockFactory(lockFactory);
 
     BlurIndex index;
     if (tableDescriptor.isReadOnly()) {
@@ -703,5 +720,4 @@ public class DistributedIndexServer extends AbstractIndexServer {
     _cache = cache;
   }
 
-  
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-core/src/main/java/org/apache/blur/server/BlurServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/server/BlurServer.java b/src/blur-core/src/main/java/org/apache/blur/server/BlurServer.java
index c0c6e57..9297e44 100644
--- a/src/blur-core/src/main/java/org/apache/blur/server/BlurServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/server/BlurServer.java
@@ -16,6 +16,14 @@ package org.apache.blur.server;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.apache.blur.metrics.MetricsConstants.ADD;
+import static org.apache.blur.metrics.MetricsConstants.DELETE;
+import static org.apache.blur.metrics.MetricsConstants.LOCAL;
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
+import static org.apache.blur.metrics.MetricsConstants.REMOTE;
+import static org.apache.blur.metrics.MetricsConstants.REQUESTS;
+import static org.apache.blur.metrics.MetricsConstants.SEARCH;
+import static org.apache.blur.metrics.MetricsConstants.UPDATE;
 import static org.apache.blur.utils.BlurConstants.BLUR_QUERYSTATUS_TRACKING_MAX;
 import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS;
 import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_CACHE_MAX_TIMETOLIVE;
@@ -77,17 +85,8 @@ import org.apache.thrift.TException;
 import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.Meter;
 import com.yammer.metrics.core.MetricName;
-
 public class BlurServer extends TableAdmin implements Iface {
 
-  private static final String REQUESTS = "Requests";
-  private static final String ORG_APACHE_BLUR = "org.apache.blur";
-  private static final String DELETE = "delete";
-  private static final String UPDATE = "update";
-  private static final String ADD = "add";
-  private static final String SEARCH = "search";
-  private static final String REMOTE = "remote";
-  private static final String LOCAL = "local";
   private static final Log LOG = LogFactory.getLog(BlurServer.class);
   private IndexServer _indexServer;
   private boolean _closed;
@@ -147,14 +146,15 @@ public class BlurServer extends TableAdmin implements Iface {
     _sessionManager = new SessionManager();
     _sessionManager.init();
     
-    localSearches = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, SEARCH), LOCAL, TimeUnit.SECONDS);
-    remoteSearches = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, SEARCH), REMOTE, TimeUnit.SECONDS);
-    localAddRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, ADD), LOCAL, TimeUnit.SECONDS);
-    remoteAddRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, ADD), REMOTE, TimeUnit.SECONDS);
-    localUpdateRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, UPDATE), LOCAL, TimeUnit.SECONDS);
-    remoteUpdateRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, UPDATE), REMOTE, TimeUnit.SECONDS);
-    localDeleteRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, DELETE), LOCAL, TimeUnit.SECONDS);
-    remoteDeleteRequests = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, DELETE), REMOTE, TimeUnit.SECONDS);
+    localSearches =         Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, SEARCH, LOCAL), LOCAL, TimeUnit.SECONDS);
+    localAddRequests =      Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, ADD, LOCAL), LOCAL, TimeUnit.SECONDS);
+    localUpdateRequests =   Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, UPDATE, LOCAL), LOCAL, TimeUnit.SECONDS);
+    localDeleteRequests =   Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, DELETE, LOCAL), LOCAL, TimeUnit.SECONDS);
+    
+    remoteSearches =        Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, SEARCH, REMOTE), REMOTE, TimeUnit.SECONDS);
+    remoteAddRequests =     Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, ADD, REMOTE), REMOTE, TimeUnit.SECONDS);
+    remoteUpdateRequests =  Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, UPDATE, REMOTE), REMOTE, TimeUnit.SECONDS);
+    remoteDeleteRequests =  Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, REQUESTS, DELETE, REMOTE), REMOTE, TimeUnit.SECONDS);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurServer.java
index 8f32a9f..0c4ebeb 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurServer.java
@@ -60,7 +60,6 @@ import org.apache.blur.manager.indexserver.DefaultBlurIndexWarmup;
 import org.apache.blur.manager.indexserver.DistributedIndexServer;
 import org.apache.blur.manager.indexserver.DistributedLayoutManager;
 import org.apache.blur.manager.writer.BlurIndexRefresher;
-import org.apache.blur.metrics.BlurMetrics;
 import org.apache.blur.server.BlurServer;
 import org.apache.blur.server.TableLayout;
 import org.apache.blur.store.blockcache.BlockCache;
@@ -128,7 +127,7 @@ public class ThriftBlurServer extends AbstractThriftServer {
     int bindPort = configuration.getInt(BLUR_SHARD_BIND_PORT, -1);
     bindPort += serverIndex;
 
-    BlurMetrics blurMetrics = new BlurMetrics(config);
+//    BlurMetrics blurMetrics = new BlurMetrics(config);
 
     int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_SHARD_PORT));
     final HttpJettyServer httpServer;
@@ -139,7 +138,7 @@ public class ThriftBlurServer extends AbstractThriftServer {
       // params
       // without reversing the mvn dependancy and making blur-gui on top.
       httpServer = new HttpJettyServer(bindPort, webServerPort, configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1),
-          configuration.getInt(BLUR_GUI_CONTROLLER_PORT, -1), configuration.getInt(BLUR_GUI_SHARD_PORT, -1), "shard", blurMetrics, null);
+          configuration.getInt(BLUR_GUI_CONTROLLER_PORT, -1), configuration.getInt(BLUR_GUI_SHARD_PORT, -1), "blur", null);
     } else {
       httpServer = null;
     }
@@ -152,7 +151,7 @@ public class ThriftBlurServer extends AbstractThriftServer {
       LOG.info("Number of slabs of block cache [{0}] with direct memory allocation set to [{1}]", slabCount, directAllocation);
       LOG.info("Block cache target memory usage, slab size of [{0}] will allocate [{1}] slabs and use ~[{2}] bytes", slabSize, slabCount, ((long) slabCount * (long) slabSize));
 
-      BufferStore.init(configuration, blurMetrics);
+      BufferStore.init(configuration);
 
       try {
         long totalMemory = (long) slabCount * (long) numberOfBlocksPerSlab * (long) blockSize;
@@ -196,7 +195,6 @@ public class ThriftBlurServer extends AbstractThriftServer {
     BlurFilterCache filterCache = getFilterCache(configuration);
 
     final DistributedIndexServer indexServer = new DistributedIndexServer();
-    indexServer.setBlurMetrics(blurMetrics);
     indexServer.setClusterStatus(clusterStatus);
     indexServer.setClusterName(configuration.get(BLUR_CLUSTER_NAME, BLUR_CLUSTER));
     indexServer.setConfiguration(config);
@@ -244,7 +242,7 @@ public class ThriftBlurServer extends AbstractThriftServer {
     blurServer.setConf(config);
     blurServer.init();
 
-    Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics, blurServer, Iface.class);
+    Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(blurServer, Iface.class);
 
     int threadCount = configuration.getInt(BLUR_SHARD_SERVER_THRIFT_THREAD_COUNT, 32);
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index c32bd57..f8c81e6 100644
--- a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -16,6 +16,9 @@ package org.apache.blur.utils;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.apache.blur.metrics.MetricsConstants.BLUR;
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
+import static org.apache.blur.metrics.MetricsConstants.THRIFT_CALLS;
 import static org.apache.blur.utils.BlurConstants.SHARD_PREFIX;
 
 import java.io.ByteArrayInputStream;
@@ -32,15 +35,15 @@ import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLongArray;
 
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.clusterstatus.ZookeeperPathConstants;
-import org.apache.blur.metrics.BlurMetrics;
-import org.apache.blur.metrics.BlurMetrics.MethodCall;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.ScoreDoc;
 import org.apache.hadoop.conf.Configurable;
@@ -70,6 +73,10 @@ import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.ZooKeeper;
 
+import com.yammer.metrics.Metrics;
+import com.yammer.metrics.core.Histogram;
+import com.yammer.metrics.core.MetricName;
+
 public class BlurUtil {
 
   private static final Object[] EMPTY_OBJECT_ARRAY = new Object[] {};
@@ -79,7 +86,13 @@ public class BlurUtil {
   private static final int ALL = Integer.MAX_VALUE;
 
   @SuppressWarnings("unchecked")
-  public static <T extends Iface> T recordMethodCallsAndAverageTimes(final BlurMetrics metrics, final T t, Class<T> clazz) {
+  public static <T extends Iface> T recordMethodCallsAndAverageTimes(final T t, Class<T> clazz) {
+    final Map<String, Histogram> histogramMap = new ConcurrentHashMap<String, Histogram>();
+    Method[] declaredMethods = Iface.class.getDeclaredMethods();
+    for (Method m : declaredMethods) {
+      String name = m.getName();
+      histogramMap.put(name, Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, BLUR, name, THRIFT_CALLS)));
+    }
     InvocationHandler handler = new InvocationHandler() {
       @Override
       public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
@@ -90,13 +103,9 @@ public class BlurUtil {
           throw e.getTargetException();
         } finally {
           long end = System.nanoTime();
-          MethodCall methodCall = metrics.methodCalls.get(method.getName());
-          if (methodCall == null) {
-            methodCall = new MethodCall();
-            metrics.methodCalls.put(method.getName(), methodCall);
-          }
-          methodCall.invokes.incrementAndGet();
-          methodCall.times.addAndGet(end - start);
+          String name = method.getName();
+          Histogram histogram = histogramMap.get(name);
+          histogram.update((end - start) / 1000);
         }
       }
     };

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-gui/src/main/java/org/apache/blur/gui/HttpJettyServer.java
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/java/org/apache/blur/gui/HttpJettyServer.java b/src/blur-gui/src/main/java/org/apache/blur/gui/HttpJettyServer.java
index 3ef5b5f..33ca980 100644
--- a/src/blur-gui/src/main/java/org/apache/blur/gui/HttpJettyServer.java
+++ b/src/blur-gui/src/main/java/org/apache/blur/gui/HttpJettyServer.java
@@ -60,8 +60,8 @@ public class HttpJettyServer {
    * @param processor
    * @throws IOException
    */
-  public HttpJettyServer(int bindPort, int port, int baseControllerPort, int baseShardPort, int baseGuiControllerPort, int baseGuiShardPort, String base, BlurMetrics bm,
-      TProcessor processor) throws IOException {
+  public HttpJettyServer(int bindPort, int port, int baseControllerPort, int baseShardPort, int baseGuiControllerPort, int baseGuiShardPort, String base, TProcessor processor)
+      throws IOException {
     server = new Server(port);
 
     String logDir = System.getProperty("blur.logs.dir");
@@ -85,7 +85,7 @@ public class HttpJettyServer {
       context.addServlet(new ServletHolder(new TServlet(processor, protocolFactory)), "/json");
     }
     context.addServlet(new ServletHolder(new LiveMetricsServlet()), "/livemetrics");
-    context.addServlet(new ServletHolder(new MetricsServlet(bm)), "/metrics");
+//    context.addServlet(new ServletHolder(new MetricsServlet(bm)), "/metrics");
     context.addServlet(new ServletHolder(new LogServlet(blurLogFile)), "/logs");
 
     LOG.info("WEB GUI coming up for resource: " + base);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
----------------------------------------------------------------------
diff --git a/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java b/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
index 295f7c7..956541d 100644
--- a/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
+++ b/src/blur-gui/src/main/java/org/apache/blur/gui/LiveMetricsServlet.java
@@ -30,35 +30,35 @@ import org.apache.blur.metrics.SystemLoadMetrics;
 
 public class LiveMetricsServlet extends HttpServlet {
 
-  private static final long serialVersionUID = 1L;
-
-  private HeapMetrics heapMetrics;
-  private SystemLoadMetrics systemLoadMetrics;
-  private QueryMetrics queryMetrics;
-
-  public LiveMetricsServlet() {
-    heapMetrics = HeapMetrics.getInstance();
-    systemLoadMetrics = SystemLoadMetrics.getInstance();
-    queryMetrics = QueryMetrics.getInstance();
-  }
-
-  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-    response.setContentType("application/json");
-    PrintWriter out = response.getWriter();
-    out.write("{");
-    out.write("\"jvm\":{\"xLabel\":\"Time\",\"yLabel\":\"Heap (GB)\",\"lines\":");
-    heapMetrics.writeJson(out);
-    out.write("}");
-    out.write(",\"blur_calls\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
-    queryMetrics.writeGraph1Json(out);
-    out.write("}");
-    out.write(",\"blur_recordRates\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
-    queryMetrics.writeGraph2Json(out);
-    out.write("}");
-    out.write(",\"system\":{\"xLabel\":\"Time\",\"yLabel\":\"Load\",\"lines\":");
-    systemLoadMetrics.writeJson(out);
-    out.write("}");
-    out.write("}");
-  }
+//  private static final long serialVersionUID = 1L;
+//
+//  private HeapMetrics heapMetrics;
+//  private SystemLoadMetrics systemLoadMetrics;
+//  private QueryMetrics queryMetrics;
+//
+//  public LiveMetricsServlet() {
+//    heapMetrics = HeapMetrics.getInstance();
+//    systemLoadMetrics = SystemLoadMetrics.getInstance();
+//    queryMetrics = QueryMetrics.getInstance();
+//  }
+//
+//  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+//    response.setContentType("application/json");
+//    PrintWriter out = response.getWriter();
+//    out.write("{");
+//    out.write("\"jvm\":{\"xLabel\":\"Time\",\"yLabel\":\"Heap (GB)\",\"lines\":");
+//    heapMetrics.writeJson(out);
+//    out.write("}");
+//    out.write(",\"blur_calls\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
+//    queryMetrics.writeGraph1Json(out);
+//    out.write("}");
+//    out.write(",\"blur_recordRates\":{\"xLabel\":\"Time\",\"yLabel\":\"Rates\",\"lines\":");
+//    queryMetrics.writeGraph2Json(out);
+//    out.write("}");
+//    out.write(",\"system\":{\"xLabel\":\"Time\",\"yLabel\":\"Load\",\"lines\":");
+//    systemLoadMetrics.writeJson(out);
+//    out.write("}");
+//    out.write("}");
+//  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-store/src/main/java/org/apache/blur/store/buffer/BufferStore.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/store/buffer/BufferStore.java b/src/blur-store/src/main/java/org/apache/blur/store/buffer/BufferStore.java
index 32c1bb2..09e8d88 100644
--- a/src/blur-store/src/main/java/org/apache/blur/store/buffer/BufferStore.java
+++ b/src/blur-store/src/main/java/org/apache/blur/store/buffer/BufferStore.java
@@ -16,41 +16,51 @@ package org.apache.blur.store.buffer;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import static org.apache.blur.metrics.MetricsConstants.INTERNAL_BUFFERS;
+import static org.apache.blur.metrics.MetricsConstants.LOST;
+import static org.apache.blur.metrics.MetricsConstants.LUCENE;
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
+import static org.apache.blur.metrics.MetricsConstants.OTHER_SIZES_ALLOCATED;
+import static org.apache.blur.metrics.MetricsConstants._1K_SIZE_ALLOCATED;
+import static org.apache.blur.metrics.MetricsConstants._8K_SIZE_ALLOCATED;
+
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.blur.BlurConfiguration;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-import org.apache.blur.metrics.BlurMetrics;
 
+import com.yammer.metrics.Metrics;
+import com.yammer.metrics.core.Meter;
+import com.yammer.metrics.core.MetricName;
 
 public class BufferStore {
 
+
+
   private static final Log LOG = LogFactory.getLog(BufferStore.class);
 
   private static BlockingQueue<byte[]> _1024 = setupBuffers(1024, 1);
   private static BlockingQueue<byte[]> _8192 = setupBuffers(8192, 1);
-  
-  // @TODO need to do a performance evaluation on the use of the atomic long counters.
-  
-  public static AtomicLong _blurShardBuffercacheLost = new AtomicLong();
-  public static AtomicLong _blurShardBuffercacheAllocate1024 = new AtomicLong();
-  public static AtomicLong _blurShardBuffercacheAllocate8192 = new AtomicLong();
-  public static AtomicLong _blurShardBuffercacheAllocateOther = new AtomicLong();
-
-  public static void init(BlurConfiguration configuration, BlurMetrics metrics) {
+
+  private static Meter _lost;
+  private static Meter _8K;
+  private static Meter _1K;
+  private static Meter _other;
+
+  public static void init(BlurConfiguration configuration) {
     int _1024Size = configuration.getInt("blur.shard.buffercache.1024", 8192);
     int _8192Size = configuration.getInt("blur.shard.buffercache.8192", 8192);
     LOG.info("Initializing the 1024 buffers with [{0}] buffers.", _1024Size);
     _1024 = setupBuffers(1024, _1024Size);
     LOG.info("Initializing the 8192 buffers with [{0}] buffers.", _8192Size);
     _8192 = setupBuffers(8192, _8192Size);
-    _blurShardBuffercacheLost = metrics.blurShardBuffercacheLost;
-    _blurShardBuffercacheAllocate1024 = metrics.blurShardBuffercacheAllocate1024;
-    _blurShardBuffercacheAllocate8192 = metrics.blurShardBuffercacheAllocate8192;
-    _blurShardBuffercacheAllocateOther = metrics.blurShardBuffercacheAllocateOther;
+    _lost = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, LUCENE, LOST, INTERNAL_BUFFERS), INTERNAL_BUFFERS, TimeUnit.SECONDS);
+    _8K = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, LUCENE, _1K_SIZE_ALLOCATED, INTERNAL_BUFFERS), INTERNAL_BUFFERS, TimeUnit.SECONDS);
+    _1K = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, LUCENE, _8K_SIZE_ALLOCATED, INTERNAL_BUFFERS), INTERNAL_BUFFERS, TimeUnit.SECONDS);
+    _other = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, LUCENE, OTHER_SIZES_ALLOCATED, INTERNAL_BUFFERS), INTERNAL_BUFFERS, TimeUnit.SECONDS);
   }
 
   private static BlockingQueue<byte[]> setupBuffers(int bufferSize, int count) {
@@ -89,7 +99,7 @@ public class BufferStore {
 
   private static void checkReturn(boolean offer) {
     if (!offer) {
-      _blurShardBuffercacheLost.incrementAndGet();
+      _lost.mark();
     }
   }
 
@@ -97,7 +107,7 @@ public class BufferStore {
     if (buf != null) {
       return buf;
     }
-    _blurShardBuffercacheAllocate1024.incrementAndGet();
+    _1K.mark();
     return new byte[1024];
   }
 
@@ -105,12 +115,12 @@ public class BufferStore {
     if (buf != null) {
       return buf;
     }
-    _blurShardBuffercacheAllocate8192.incrementAndGet();
+    _8K.mark();
     return new byte[8192];
   }
 
   private static byte[] newBuffer(int size) {
-    _blurShardBuffercacheAllocateOther.incrementAndGet();
+    _other.mark();
     return new byte[size];
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java b/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
index 9881dd2..ab6ad1b 100644
--- a/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
+++ b/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
@@ -17,6 +17,9 @@ package org.apache.blur.store.hdfs;
  * limitations under the License.
  */
 
+import static org.apache.blur.metrics.MetricsConstants.BLUR;
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
@@ -48,7 +51,6 @@ import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.Histogram;
 import com.yammer.metrics.core.Meter;
 import com.yammer.metrics.core.MetricName;
-
 public class HdfsDirectory extends Directory {
 
   private static final Log LOG = LogFactory.getLog(HdfsDirectory.class);
@@ -122,14 +124,12 @@ public class HdfsDirectory extends Directory {
       URI uri = fileSystem.getUri();
       MetricsGroup metricsGroup = metricsGroupMap.get(uri);
       if (metricsGroup == null) {
-        String group = "org.apache.blur";
-        String type = "HDFS";
         String scope = uri.toString();
         
-        Histogram readAccess = Metrics.newHistogram(new MetricName(group, type, "Read Latency in \u00B5s", scope));
-        Histogram writeAccess = Metrics.newHistogram(new MetricName(group, type, "Write Latency in \u00B5s", scope));
-        Meter readThroughput = Metrics.newMeter(new MetricName(group, type, "Read Throughput", scope), "Read Bytes", TimeUnit.SECONDS);
-        Meter writeThroughput = Metrics.newMeter(new MetricName(group, type, "Write Throughput", scope), "Write Bytes", TimeUnit.SECONDS);
+        Histogram readAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, BLUR, "Read Latency in \u00B5s", scope));
+        Histogram writeAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, BLUR, "Write Latency in \u00B5s", scope));
+        Meter readThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, BLUR, "Read Throughput", scope), "Read Bytes", TimeUnit.SECONDS);
+        Meter writeThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, BLUR, "Write Throughput", scope), "Write Bytes", TimeUnit.SECONDS);
         metricsGroup = new MetricsGroup(readAccess, writeAccess, readThroughput, writeThroughput);
         metricsGroupMap.put(uri, metricsGroup);
       }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-util/src/main/java/org/apache/blur/metrics/AtomicLongGauge.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/AtomicLongGauge.java b/src/blur-util/src/main/java/org/apache/blur/metrics/AtomicLongGauge.java
new file mode 100644
index 0000000..02e6fce
--- /dev/null
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/AtomicLongGauge.java
@@ -0,0 +1,24 @@
+package org.apache.blur.metrics;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import com.yammer.metrics.core.Gauge;
+
+public class AtomicLongGauge extends Gauge<Long> {
+
+  private final AtomicLong at;
+
+  public AtomicLongGauge(AtomicLong at) {
+    this.at = at;
+  }
+
+  @Override
+  public Long value() {
+    return at.get();
+  }
+
+  public static Gauge<Long> wrap(AtomicLong at) {
+    return new AtomicLongGauge(at);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-util/src/main/java/org/apache/blur/metrics/BlurMetrics.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/BlurMetrics.java b/src/blur-util/src/main/java/org/apache/blur/metrics/BlurMetrics.java
index abe0a2d..16f1d11 100644
--- a/src/blur-util/src/main/java/org/apache/blur/metrics/BlurMetrics.java
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/BlurMetrics.java
@@ -28,98 +28,102 @@ import org.apache.hadoop.metrics.MetricsUtil;
 import org.apache.hadoop.metrics.Updater;
 import org.apache.hadoop.metrics.jvm.JvmMetrics;
 
-public class BlurMetrics implements Updater {
-
-  public static class MethodCall {
-    public AtomicLong invokes = new AtomicLong();
-    public AtomicLong times = new AtomicLong();
-  }
-
-  public AtomicLong blockCacheHit = new AtomicLong(0);
-  public AtomicLong blockCacheMiss = new AtomicLong(0);
-  public AtomicLong blockCacheEviction = new AtomicLong(0);
-  public AtomicLong blockCacheSize = new AtomicLong(0);
-  public AtomicLong rowReads = new AtomicLong(0);
-  public AtomicLong rowWrites = new AtomicLong(0);
-  public AtomicLong recordReads = new AtomicLong(0);
-  public AtomicLong recordWrites = new AtomicLong(0);
-  public AtomicLong queriesExternal = new AtomicLong(0);
-  public AtomicLong queriesInternal = new AtomicLong(0);
-  public AtomicLong blurShardBuffercacheAllocate1024 = new AtomicLong(0);
-  public AtomicLong blurShardBuffercacheAllocate8192 = new AtomicLong(0);
-  public AtomicLong blurShardBuffercacheAllocateOther = new AtomicLong(0);
-  public AtomicLong blurShardBuffercacheLost = new AtomicLong(0);
-  public Map<String, MethodCall> methodCalls = new ConcurrentHashMap<String, MethodCall>();
-
-  public AtomicLong tableCount = new AtomicLong(0);
-  public AtomicLong rowCount = new AtomicLong(0);
-  public AtomicLong recordCount = new AtomicLong(0);
-  public AtomicLong indexCount = new AtomicLong(0);
-  public AtomicLong indexMemoryUsage = new AtomicLong(0);
-  public AtomicLong segmentCount = new AtomicLong(0);
-
-  private MetricsRecord _metricsRecord;
-  private long _previous = System.nanoTime();
-
-  public static void main(String[] args) throws InterruptedException {
-    Configuration conf = new Configuration();
-    BlurMetrics blurMetrics = new BlurMetrics(conf);
-    MethodCall methodCall = new MethodCall();
-    blurMetrics.methodCalls.put("test", methodCall);
-    for (int i = 0; i < 100; i++) {
-      blurMetrics.blockCacheHit.incrementAndGet();
-      blurMetrics.blockCacheMiss.incrementAndGet();
-      methodCall.invokes.incrementAndGet();
-      methodCall.times.addAndGet(56000000);
-      Thread.sleep(500);
-    }
-  }
-
-  public BlurMetrics(Configuration conf) {
-    JvmMetrics.init("blur", Long.toString(System.currentTimeMillis()));
-    MetricsContext metricsContext = MetricsUtil.getContext("blur");
-    _metricsRecord = MetricsUtil.createRecord(metricsContext, "metrics");
-    metricsContext.registerUpdater(this);
-  }
-
-  @Override
-  public void doUpdates(MetricsContext context) {
-    synchronized (this) {
-      long now = System.nanoTime();
-      float seconds = (now - _previous) / 1000000000.0f;
-      _metricsRecord.setMetric("blockcache.hit", getPerSecond(blockCacheHit.getAndSet(0), seconds));
-      _metricsRecord.setMetric("blockcache.miss", getPerSecond(blockCacheMiss.getAndSet(0), seconds));
-      _metricsRecord.setMetric("blockcache.eviction", getPerSecond(blockCacheEviction.getAndSet(0), seconds));
-      _metricsRecord.setMetric("blockcache.size", blockCacheSize.get());
-      _metricsRecord.setMetric("row.reads", getPerSecond(rowReads.getAndSet(0), seconds));
-      _metricsRecord.setMetric("row.writes", getPerSecond(rowWrites.getAndSet(0), seconds));
-      _metricsRecord.setMetric("record.reads", getPerSecond(recordReads.getAndSet(0), seconds));
-      _metricsRecord.setMetric("record.writes", getPerSecond(recordWrites.getAndSet(0), seconds));
-      _metricsRecord.setMetric("query.external", getPerSecond(queriesExternal.getAndSet(0), seconds));
-      _metricsRecord.setMetric("query.internal", getPerSecond(queriesInternal.getAndSet(0), seconds));
-      for (Entry<String, MethodCall> entry : methodCalls.entrySet()) {
-        String key = entry.getKey();
-        MethodCall value = entry.getValue();
-        long invokes = value.invokes.getAndSet(0);
-        long times = value.times.getAndSet(0);
-
-        float avgTimes = (times / (float) invokes) / 1000000000.0f;
-        _metricsRecord.setMetric("methodcalls." + key + ".count", getPerSecond(invokes, seconds));
-        _metricsRecord.setMetric("methodcalls." + key + ".time", avgTimes);
-      }
-      _metricsRecord.setMetric("tables", tableCount.get());
-      _metricsRecord.setMetric("rows", rowCount.get());
-      _metricsRecord.setMetric("records", recordCount.get());
-      _metricsRecord.setMetric("index.count", indexCount.get());
-      _metricsRecord.setMetric("index.memoryusage", indexMemoryUsage.get());
-      _metricsRecord.setMetric("index.segments", segmentCount.get());
-      _previous = now;
-    }
-    _metricsRecord.update();
-  }
-
-  private float getPerSecond(long value, float seconds) {
-    return (float) (value / seconds);
-  }
-
+public class BlurMetrics {
+  
 }
+
+//public class BlurMetrics implements Updater {
+//
+//  public static class MethodCall {
+//    public AtomicLong invokes = new AtomicLong();
+//    public AtomicLong times = new AtomicLong();
+//  }
+//
+//  public AtomicLong blockCacheHit = new AtomicLong(0);
+//  public AtomicLong blockCacheMiss = new AtomicLong(0);
+//  public AtomicLong blockCacheEviction = new AtomicLong(0);
+//  public AtomicLong blockCacheSize = new AtomicLong(0);
+//  public AtomicLong rowReads = new AtomicLong(0);
+//  public AtomicLong rowWrites = new AtomicLong(0);
+//  public AtomicLong recordReads = new AtomicLong(0);
+//  public AtomicLong recordWrites = new AtomicLong(0);
+//  public AtomicLong queriesExternal = new AtomicLong(0);
+//  public AtomicLong queriesInternal = new AtomicLong(0);
+//  public AtomicLong blurShardBuffercacheAllocate1024 = new AtomicLong(0);
+//  public AtomicLong blurShardBuffercacheAllocate8192 = new AtomicLong(0);
+//  public AtomicLong blurShardBuffercacheAllocateOther = new AtomicLong(0);
+//  public AtomicLong blurShardBuffercacheLost = new AtomicLong(0);
+//  public Map<String, MethodCall> methodCalls = new ConcurrentHashMap<String, MethodCall>();
+//
+//  public AtomicLong tableCount = new AtomicLong(0);
+//  public AtomicLong rowCount = new AtomicLong(0);
+//  public AtomicLong recordCount = new AtomicLong(0);
+//  public AtomicLong indexCount = new AtomicLong(0);
+//  public AtomicLong indexMemoryUsage = new AtomicLong(0);
+//  public AtomicLong segmentCount = new AtomicLong(0);
+//
+//  private MetricsRecord _metricsRecord;
+//  private long _previous = System.nanoTime();
+//
+//  public static void main(String[] args) throws InterruptedException {
+//    Configuration conf = new Configuration();
+//    BlurMetrics blurMetrics = new BlurMetrics(conf);
+//    MethodCall methodCall = new MethodCall();
+//    blurMetrics.methodCalls.put("test", methodCall);
+//    for (int i = 0; i < 100; i++) {
+//      blurMetrics.blockCacheHit.incrementAndGet();
+//      blurMetrics.blockCacheMiss.incrementAndGet();
+//      methodCall.invokes.incrementAndGet();
+//      methodCall.times.addAndGet(56000000);
+//      Thread.sleep(500);
+//    }
+//  }
+//
+//  public BlurMetrics(Configuration conf) {
+//    JvmMetrics.init("blur", Long.toString(System.currentTimeMillis()));
+//    MetricsContext metricsContext = MetricsUtil.getContext("blur");
+//    _metricsRecord = MetricsUtil.createRecord(metricsContext, "metrics");
+//    metricsContext.registerUpdater(this);
+//  }
+//
+//  @Override
+//  public void doUpdates(MetricsContext context) {
+//    synchronized (this) {
+//      long now = System.nanoTime();
+//      float seconds = (now - _previous) / 1000000000.0f;
+//      _metricsRecord.setMetric("blockcache.hit", getPerSecond(blockCacheHit.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("blockcache.miss", getPerSecond(blockCacheMiss.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("blockcache.eviction", getPerSecond(blockCacheEviction.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("blockcache.size", blockCacheSize.get());
+//      _metricsRecord.setMetric("row.reads", getPerSecond(rowReads.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("row.writes", getPerSecond(rowWrites.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("record.reads", getPerSecond(recordReads.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("record.writes", getPerSecond(recordWrites.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("query.external", getPerSecond(queriesExternal.getAndSet(0), seconds));
+//      _metricsRecord.setMetric("query.internal", getPerSecond(queriesInternal.getAndSet(0), seconds));
+//      for (Entry<String, MethodCall> entry : methodCalls.entrySet()) {
+//        String key = entry.getKey();
+//        MethodCall value = entry.getValue();
+//        long invokes = value.invokes.getAndSet(0);
+//        long times = value.times.getAndSet(0);
+//
+//        float avgTimes = (times / (float) invokes) / 1000000000.0f;
+//        _metricsRecord.setMetric("methodcalls." + key + ".count", getPerSecond(invokes, seconds));
+//        _metricsRecord.setMetric("methodcalls." + key + ".time", avgTimes);
+//      }
+//      _metricsRecord.setMetric("tables", tableCount.get());
+//      _metricsRecord.setMetric("rows", rowCount.get());
+//      _metricsRecord.setMetric("records", recordCount.get());
+//      _metricsRecord.setMetric("index.count", indexCount.get());
+//      _metricsRecord.setMetric("index.memoryusage", indexMemoryUsage.get());
+//      _metricsRecord.setMetric("index.segments", segmentCount.get());
+//      _previous = now;
+//    }
+//    _metricsRecord.update();
+//  }
+//
+//  private float getPerSecond(long value, float seconds) {
+//    return (float) (value / seconds);
+//  }
+//
+//}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java b/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
index 8232fb2..db286d4 100644
--- a/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/HeapMetrics.java
@@ -24,80 +24,84 @@ import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
 
-public class HeapMetrics extends TimerTask {
-
-  private static final double ONE_GIG = 1024 * 1024 * 1024;
-  private final int sampleSize = (int) TimeUnit.MINUTES.toSeconds(10);
-  private final Timer timer;
-  private final long period = TimeUnit.SECONDS.toMillis(1);
-  private final long[] heapMemoryUsageUsedHistory = new long[sampleSize];
-  private final long[] heapMemoryUsageCommittedHistory = new long[sampleSize];
-  private final long[] timestamp = new long[sampleSize];
-  private volatile static HeapMetrics heapMetrics;
-  private volatile int position = 0;
-
-  public static synchronized HeapMetrics getInstance() {
-    if (heapMetrics == null) {
-      heapMetrics = new HeapMetrics();
-    }
-    return heapMetrics;
-  }
-
-  private HeapMetrics() {
-    timer = new Timer("HeapMetrics", true);
-    timer.scheduleAtFixedRate(this, period, period);
-  }
-
-  @Override
-  public void run() {
-    synchronized (this) {
-      if (position >= sampleSize) {
-        position = 0;
-      }
-      MemoryUsage heapMemoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
-      setValue(heapMemoryUsage.getUsed(), heapMemoryUsageUsedHistory);
-      setValue(heapMemoryUsage.getCommitted(), heapMemoryUsageCommittedHistory);
-      setValue(System.currentTimeMillis(), timestamp);
-      position++;
-    }
-  }
-
-  private void setValue(long value, long[] history) {
-    history[position] = value;
-  }
-
-  public void writeJson(PrintWriter out) {
-    synchronized (this) {
-      out.print("{\"labels\":[");
-      out.print("{\"name\":\"used\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
-      out.print("{\"name\":\"committed\",\"style\":{\"stroke\":\"Red\"}}");
-      out.print("],\"data\":[");
-      int p = position;
-      boolean comma = false;
-      for (int i = 0; i < sampleSize; i++, p++) {
-        if (p >= sampleSize) {
-          p = 0;
-        }
-        double used = ((double) heapMemoryUsageUsedHistory[p]) / ONE_GIG;
-        double committed = ((double) heapMemoryUsageCommittedHistory[p]) / ONE_GIG;
-
-        long t = timestamp[p];
-        if (t == 0) {
-          continue;
-        }
-        if (comma) {
-          out.print(",");
-        }
-        out.print("{\"used\":");
-        out.print(used);
-        out.print(",\"committed\":");
-        out.print(committed);
-        out.print(",\"recordTime\":");
-        out.print(t);
-        out.print('}');
-        comma = true;
-      }
-      out.print("]}");
-    }
-  }
+public class HeapMetrics {
+  
 }
+
+//public class HeapMetrics extends TimerTask {
+//
+//  private static final double ONE_GIG = 1024 * 1024 * 1024;
+//  private final int sampleSize = (int) TimeUnit.MINUTES.toSeconds(10);
+//  private final Timer timer;
+//  private final long period = TimeUnit.SECONDS.toMillis(1);
+//  private final long[] heapMemoryUsageUsedHistory = new long[sampleSize];
+//  private final long[] heapMemoryUsageCommittedHistory = new long[sampleSize];
+//  private final long[] timestamp = new long[sampleSize];
+//  private volatile static HeapMetrics heapMetrics;
+//  private volatile int position = 0;
+//
+//  public static synchronized HeapMetrics getInstance() {
+//    if (heapMetrics == null) {
+//      heapMetrics = new HeapMetrics();
+//    }
+//    return heapMetrics;
+//  }
+//
+//  private HeapMetrics() {
+//    timer = new Timer("HeapMetrics", true);
+//    timer.scheduleAtFixedRate(this, period, period);
+//  }
+//
+//  @Override
+//  public void run() {
+//    synchronized (this) {
+//      if (position >= sampleSize) {
+//        position = 0;
+//      }
+//      MemoryUsage heapMemoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+//      setValue(heapMemoryUsage.getUsed(), heapMemoryUsageUsedHistory);
+//      setValue(heapMemoryUsage.getCommitted(), heapMemoryUsageCommittedHistory);
+//      setValue(System.currentTimeMillis(), timestamp);
+//      position++;
+//    }
+//  }
+//
+//  private void setValue(long value, long[] history) {
+//    history[position] = value;
+//  }
+//
+//  public void writeJson(PrintWriter out) {
+//    synchronized (this) {
+//      out.print("{\"labels\":[");
+//      out.print("{\"name\":\"used\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
+//      out.print("{\"name\":\"committed\",\"style\":{\"stroke\":\"Red\"}}");
+//      out.print("],\"data\":[");
+//      int p = position;
+//      boolean comma = false;
+//      for (int i = 0; i < sampleSize; i++, p++) {
+//        if (p >= sampleSize) {
+//          p = 0;
+//        }
+//        double used = ((double) heapMemoryUsageUsedHistory[p]) / ONE_GIG;
+//        double committed = ((double) heapMemoryUsageCommittedHistory[p]) / ONE_GIG;
+//
+//        long t = timestamp[p];
+//        if (t == 0) {
+//          continue;
+//        }
+//        if (comma) {
+//          out.print(",");
+//        }
+//        out.print("{\"used\":");
+//        out.print(used);
+//        out.print(",\"committed\":");
+//        out.print(committed);
+//        out.print(",\"recordTime\":");
+//        out.print(t);
+//        out.print('}');
+//        comma = true;
+//      }
+//      out.print("]}");
+//    }
+//  }
+//}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-util/src/main/java/org/apache/blur/metrics/MetricsConstants.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/MetricsConstants.java b/src/blur-util/src/main/java/org/apache/blur/metrics/MetricsConstants.java
new file mode 100644
index 0000000..114fafe
--- /dev/null
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/MetricsConstants.java
@@ -0,0 +1,20 @@
+package org.apache.blur.metrics;
+
+public class MetricsConstants {
+  public static final String LUCENE = "Lucene";
+  public static final String BLUR = "Blur";
+  public static final String ORG_APACHE_BLUR = "org.apache.blur";
+  public static final String INTERNAL_BUFFERS = "Internal Buffers";
+  public static final String OTHER_SIZES_ALLOCATED = "Other Sizes Allocated";
+  public static final String _8K_SIZE_ALLOCATED = "8K Size Allocated";
+  public static final String _1K_SIZE_ALLOCATED = "1K Size Allocated";
+  public static final String LOST = "Lost";
+  public static final String THRIFT_CALLS = "Thrift Calls in \u00B5s";
+  public static final String REQUESTS = "Requests";
+  public static final String DELETE = "delete";
+  public static final String UPDATE = "update";
+  public static final String ADD = "add";
+  public static final String SEARCH = "search";
+  public static final String REMOTE = "remote";
+  public static final String LOCAL = "local";
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3a69cb1/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java b/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
index 355bf9d..293e8de 100644
--- a/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
+++ b/src/blur-util/src/main/java/org/apache/blur/metrics/QueryMetrics.java
@@ -23,175 +23,177 @@ import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
-public class QueryMetrics extends TimerTask {
-
-  private final int sampleSize = (int) TimeUnit.MINUTES.toSeconds(10);
-  private final AtomicLong _queryCount = new AtomicLong();
-  private final AtomicLong _queryTime = new AtomicLong();
-  private final AtomicLong _queryExceptionCount = new AtomicLong();
-  private final AtomicLong _dataFetchCount = new AtomicLong();
-  private final AtomicLong _dataFetchTime = new AtomicLong();
-  private final AtomicLong _dataFetchRecordCount = new AtomicLong();
-  private final AtomicLong _dataMutateCount = new AtomicLong();
-  private final AtomicLong _dataMutateTime = new AtomicLong();
-  private final AtomicLong _dataMutateRecordCount = new AtomicLong();
-  private final Timer timer;
-  private final long period = TimeUnit.SECONDS.toMillis(1);
-  private final double[] _queryRate = new double[sampleSize];
-  private final double[] _queryResponse = new double[sampleSize];
-  private final double[] _queryExceptionRate = new double[sampleSize];
-  private final double[] _fetchRate = new double[sampleSize];
-  private final double[] _fetchResponse = new double[sampleSize];
-  private final double[] _fetchRecordRate = new double[sampleSize];
-  private final double[] _mutateRate = new double[sampleSize];
-  private final double[] _mutateResponse = new double[sampleSize];
-  private final double[] _mutateRecordRate = new double[sampleSize];
-  private final long[] timestamp = new long[sampleSize];
-  private volatile static QueryMetrics instance;
-  private volatile int position;
-
-  public static synchronized QueryMetrics getInstance() {
-    if (instance == null) {
-      instance = new QueryMetrics();
-    }
-    return instance;
-  }
-
-  private QueryMetrics() {
-    timer = new Timer("QueryMetrics", true);
-    timer.scheduleAtFixedRate(this, period, period);
-  }
-
-  @Override
-  public void run() {
-    synchronized (this) {
-      if (position >= sampleSize) {
-        position = 0;
-      }
-      long queryCount = _queryCount.getAndSet(0);
-      long queryTime = _queryTime.getAndSet(0);
-      long queryExceptionCount = _queryExceptionCount.getAndSet(0);
-
-      long dataFetchCount = _dataFetchCount.getAndSet(0);
-      long dataFetchTime = _dataFetchTime.getAndSet(0);
-      long dataFetchRecordCount = _dataFetchRecordCount.getAndSet(0);
-
-      long dataMutateCount = _dataMutateCount.getAndSet(0);
-      long dataMutateTime = _dataMutateTime.getAndSet(0);
-      long dataMutateRecordCount = _dataMutateRecordCount.getAndSet(0);
-
-      _queryRate[position] = queryCount;
-      _queryResponse[position] = TimeUnit.NANOSECONDS.toMillis(queryTime) / (double) queryCount;
-
-      _queryExceptionRate[position] = queryExceptionCount;
-
-      _fetchRate[position] = dataFetchCount;
-      _fetchResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataFetchTime) / (double) dataFetchCount;
-      _fetchRecordRate[position] = dataFetchRecordCount;
-
-      _mutateRate[position] = dataMutateCount;
-      _mutateResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataMutateTime) / (double) dataMutateCount;
-      _mutateRecordRate[position] = dataMutateRecordCount;
-
-      timestamp[position] = System.currentTimeMillis();
-      position++;
-    }
-  }
-
-  public void recordQuery(long totalTimeNs) {
-    _queryCount.incrementAndGet();
-    _queryTime.addAndGet(totalTimeNs);
-  }
-
-  public void recordQueryExceptions() {
-    _queryExceptionCount.incrementAndGet();
-  }
-
-  public void recordDataFetch(long totalTimeNs, long records) {
-    _dataFetchCount.incrementAndGet();
-    _dataFetchTime.addAndGet(totalTimeNs);
-    _dataFetchRecordCount.addAndGet(records);
-  }
-
-  public void recordDataMutate(long totalTimeNs, long records) {
-    _dataMutateCount.incrementAndGet();
-    _dataMutateTime.addAndGet(totalTimeNs);
-    _dataMutateRecordCount.addAndGet(records);
-  }
-
-  public void writeGraph1Json(PrintWriter out) {
-    synchronized (this) {
-      out.print("{\"labels\":[");
-      out.print("{\"name\":\"query\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
-      out.print("{\"name\":\"fetch\",\"style\":{\"stroke\":\"Black\"}},");
-      out.print("{\"name\":\"mutate\",\"style\":{\"stroke\":\"Orange\"}},");
-      out.print("{\"name\":\"except\",\"style\":{\"stroke\":\"Red\"}}");
-      out.print("],\"data\":[");
-      int p = position;
-      boolean comma = false;
-      for (int i = 0; i < sampleSize; i++, p++) {
-        if (p >= sampleSize) {
-          p = 0;
-        }
-        double query = _queryRate[p];
-        double fetch = _fetchRate[p];
-        double mutate = _mutateRate[p];
-        double except = _queryExceptionRate[p];
-        long t = timestamp[p];
-        if (t == 0) {
-          continue;
-        }
-        if (comma) {
-          out.print(",");
-        }
-        out.print("{\"query\":");
-        out.print(query);
-        out.print(",\"fetch\":");
-        out.print(fetch);
-        out.print(",\"mutate\":");
-        out.print(mutate);
-        out.print(",\"except\":");
-        out.print(except);
-        out.print(",\"recordTime\":");
-        out.print(t);
-        out.print('}');
-        comma = true;
-      }
-      out.print("]}");
-    }
-  }
-  
-  public void writeGraph2Json(PrintWriter out) {
-    synchronized (this) {
-      out.print("{\"labels\":[");
-      out.print("{\"name\":\"fetchRecord\",\"style\":{\"stroke\":\"Black\"}},");
-      out.print("{\"name\":\"mutateRecord\",\"style\":{\"stroke\":\"Orange\"}}");
-      out.print("],\"data\":[");
-      int p = position;
-      boolean comma = false;
-      for (int i = 0; i < sampleSize; i++, p++) {
-        if (p >= sampleSize) {
-          p = 0;
-        }
-        double fetch = _fetchRecordRate[p];
-        double mutate = _mutateRecordRate[p];
-        long t = timestamp[p];
-        if (t == 0) {
-          continue;
-        }
-        if (comma) {
-          out.print(",");
-        }
-        out.print("{\"fetchRecord\":");
-        out.print(fetch);
-        out.print(",\"mutateRecord\":");
-        out.print(mutate);
-        out.print(",\"recordTime\":");
-        out.print(t);
-        out.print('}');
-        comma = true;
-      }
-      out.print("]}");
-    }
-  }
-}
+public class QueryMetrics {}
+
+//public class QueryMetrics extends TimerTask {
+//
+//  private final int sampleSize = (int) TimeUnit.MINUTES.toSeconds(10);
+//  private final AtomicLong _queryCount = new AtomicLong();
+//  private final AtomicLong _queryTime = new AtomicLong();
+//  private final AtomicLong _queryExceptionCount = new AtomicLong();
+//  private final AtomicLong _dataFetchCount = new AtomicLong();
+//  private final AtomicLong _dataFetchTime = new AtomicLong();
+//  private final AtomicLong _dataFetchRecordCount = new AtomicLong();
+//  private final AtomicLong _dataMutateCount = new AtomicLong();
+//  private final AtomicLong _dataMutateTime = new AtomicLong();
+//  private final AtomicLong _dataMutateRecordCount = new AtomicLong();
+//  private final Timer timer;
+//  private final long period = TimeUnit.SECONDS.toMillis(1);
+//  private final double[] _queryRate = new double[sampleSize];
+//  private final double[] _queryResponse = new double[sampleSize];
+//  private final double[] _queryExceptionRate = new double[sampleSize];
+//  private final double[] _fetchRate = new double[sampleSize];
+//  private final double[] _fetchResponse = new double[sampleSize];
+//  private final double[] _fetchRecordRate = new double[sampleSize];
+//  private final double[] _mutateRate = new double[sampleSize];
+//  private final double[] _mutateResponse = new double[sampleSize];
+//  private final double[] _mutateRecordRate = new double[sampleSize];
+//  private final long[] timestamp = new long[sampleSize];
+//  private volatile static QueryMetrics instance;
+//  private volatile int position;
+//
+//  public static synchronized QueryMetrics getInstance() {
+//    if (instance == null) {
+//      instance = new QueryMetrics();
+//    }
+//    return instance;
+//  }
+//
+//  private QueryMetrics() {
+//    timer = new Timer("QueryMetrics", true);
+//    timer.scheduleAtFixedRate(this, period, period);
+//  }
+//
+//  @Override
+//  public void run() {
+//    synchronized (this) {
+//      if (position >= sampleSize) {
+//        position = 0;
+//      }
+//      long queryCount = _queryCount.getAndSet(0);
+//      long queryTime = _queryTime.getAndSet(0);
+//      long queryExceptionCount = _queryExceptionCount.getAndSet(0);
+//
+//      long dataFetchCount = _dataFetchCount.getAndSet(0);
+//      long dataFetchTime = _dataFetchTime.getAndSet(0);
+//      long dataFetchRecordCount = _dataFetchRecordCount.getAndSet(0);
+//
+//      long dataMutateCount = _dataMutateCount.getAndSet(0);
+//      long dataMutateTime = _dataMutateTime.getAndSet(0);
+//      long dataMutateRecordCount = _dataMutateRecordCount.getAndSet(0);
+//
+//      _queryRate[position] = queryCount;
+//      _queryResponse[position] = TimeUnit.NANOSECONDS.toMillis(queryTime) / (double) queryCount;
+//
+//      _queryExceptionRate[position] = queryExceptionCount;
+//
+//      _fetchRate[position] = dataFetchCount;
+//      _fetchResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataFetchTime) / (double) dataFetchCount;
+//      _fetchRecordRate[position] = dataFetchRecordCount;
+//
+//      _mutateRate[position] = dataMutateCount;
+//      _mutateResponse[position] = TimeUnit.NANOSECONDS.toMillis(dataMutateTime) / (double) dataMutateCount;
+//      _mutateRecordRate[position] = dataMutateRecordCount;
+//
+//      timestamp[position] = System.currentTimeMillis();
+//      position++;
+//    }
+//  }
+//
+//  public void recordQuery(long totalTimeNs) {
+//    _queryCount.incrementAndGet();
+//    _queryTime.addAndGet(totalTimeNs);
+//  }
+//
+//  public void recordQueryExceptions() {
+//    _queryExceptionCount.incrementAndGet();
+//  }
+//
+//  public void recordDataFetch(long totalTimeNs, long records) {
+//    _dataFetchCount.incrementAndGet();
+//    _dataFetchTime.addAndGet(totalTimeNs);
+//    _dataFetchRecordCount.addAndGet(records);
+//  }
+//
+//  public void recordDataMutate(long totalTimeNs, long records) {
+//    _dataMutateCount.incrementAndGet();
+//    _dataMutateTime.addAndGet(totalTimeNs);
+//    _dataMutateRecordCount.addAndGet(records);
+//  }
+//
+//  public void writeGraph1Json(PrintWriter out) {
+//    synchronized (this) {
+//      out.print("{\"labels\":[");
+//      out.print("{\"name\":\"query\",\"style\":{\"stroke\":\"RoyalBlue\"}},");
+//      out.print("{\"name\":\"fetch\",\"style\":{\"stroke\":\"Black\"}},");
+//      out.print("{\"name\":\"mutate\",\"style\":{\"stroke\":\"Orange\"}},");
+//      out.print("{\"name\":\"except\",\"style\":{\"stroke\":\"Red\"}}");
+//      out.print("],\"data\":[");
+//      int p = position;
+//      boolean comma = false;
+//      for (int i = 0; i < sampleSize; i++, p++) {
+//        if (p >= sampleSize) {
+//          p = 0;
+//        }
+//        double query = _queryRate[p];
+//        double fetch = _fetchRate[p];
+//        double mutate = _mutateRate[p];
+//        double except = _queryExceptionRate[p];
+//        long t = timestamp[p];
+//        if (t == 0) {
+//          continue;
+//        }
+//        if (comma) {
+//          out.print(",");
+//        }
+//        out.print("{\"query\":");
+//        out.print(query);
+//        out.print(",\"fetch\":");
+//        out.print(fetch);
+//        out.print(",\"mutate\":");
+//        out.print(mutate);
+//        out.print(",\"except\":");
+//        out.print(except);
+//        out.print(",\"recordTime\":");
+//        out.print(t);
+//        out.print('}');
+//        comma = true;
+//      }
+//      out.print("]}");
+//    }
+//  }
+//  
+//  public void writeGraph2Json(PrintWriter out) {
+//    synchronized (this) {
+//      out.print("{\"labels\":[");
+//      out.print("{\"name\":\"fetchRecord\",\"style\":{\"stroke\":\"Black\"}},");
+//      out.print("{\"name\":\"mutateRecord\",\"style\":{\"stroke\":\"Orange\"}}");
+//      out.print("],\"data\":[");
+//      int p = position;
+//      boolean comma = false;
+//      for (int i = 0; i < sampleSize; i++, p++) {
+//        if (p >= sampleSize) {
+//          p = 0;
+//        }
+//        double fetch = _fetchRecordRate[p];
+//        double mutate = _mutateRecordRate[p];
+//        long t = timestamp[p];
+//        if (t == 0) {
+//          continue;
+//        }
+//        if (comma) {
+//          out.print(",");
+//        }
+//        out.print("{\"fetchRecord\":");
+//        out.print(fetch);
+//        out.print(",\"mutateRecord\":");
+//        out.print(mutate);
+//        out.print(",\"recordTime\":");
+//        out.print(t);
+//        out.print('}');
+//        comma = true;
+//      }
+//      out.print("]}");
+//    }
+//  }
+//}


Mime
View raw message