accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject accumulo git commit: Lift lots of constants into a single place. Make avgFilesPerTablet a gauge and not a stat so we get the double value.
Date Thu, 04 Dec 2014 23:25:53 GMT
Repository: accumulo
Updated Branches:
  refs/heads/metrics2-backwardscompat e199f1b1d -> 43df5e7fc


Lift lots of constants into a single place. Make avgFilesPerTablet a gauge and not a stat so we get the double value.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/43df5e7f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/43df5e7f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/43df5e7f

Branch: refs/heads/metrics2-backwardscompat
Commit: 43df5e7fc2a5c1d639965eaf6fbf86849829560a
Parents: e199f1b
Author: Josh Elser <elserj@apache.org>
Authored: Thu Dec 4 18:25:14 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Dec 4 18:25:14 2014 -0500

----------------------------------------------------------------------
 .../apache/accumulo/server/metrics/Metrics.java |   3 +
 .../server/metrics/Metrics2ThriftMetrics.java   |   7 +-
 .../accumulo/server/metrics/MetricsFactory.java |   3 +-
 .../server/metrics/ThriftMetricsMBean.java      |  25 ++-
 .../master/metrics/MasterMetricsFactory.java    |   3 +-
 .../apache/accumulo/tserver/TabletServer.java   |  22 +--
 .../metrics/Metrics2TabletServerMetrics.java    | 153 +++----------------
 .../Metrics2TabletServerMinCMetrics.java        |  22 +--
 .../Metrics2TabletServerScanMetrics.java        |  18 ++-
 .../Metrics2TabletServerUpdateMetrics.java      |  58 +++----
 .../tserver/metrics/TabletServerMBeanImpl.java  |  79 +++-------
 .../metrics/TabletServerMetricsFactory.java     |  17 ++-
 .../metrics/TabletServerMinCMetrics.java        |  16 +-
 .../metrics/TabletServerMinCMetricsMBean.java   |  25 ++-
 .../metrics/TabletServerScanMetrics.java        |  20 +--
 .../metrics/TabletServerScanMetricsMBean.java   |  25 ++-
 .../metrics/TabletServerUpdateMetrics.java      |  50 +++---
 .../metrics/TabletServerUpdateMetricsMBean.java |  48 +++---
 .../apache/accumulo/tserver/tablet/Tablet.java  |   4 +-
 19 files changed, 224 insertions(+), 374 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics.java b/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics.java
index 6c79b28..ef0a1d5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics.java
@@ -20,6 +20,9 @@ package org.apache.accumulo.server.metrics;
  *
  */
 public interface Metrics {
+
+  String PREFIX = "Accumulo";
+
   void register() throws Exception;
 
   void add(String name, long time);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics2ThriftMetrics.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics2ThriftMetrics.java b/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics2ThriftMetrics.java
index f0b091f..b7330e3 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics2ThriftMetrics.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/metrics/Metrics2ThriftMetrics.java
@@ -26,14 +26,15 @@ import org.apache.hadoop.metrics2.lib.MetricsRegistry;
 /**
  *
  */
-public class Metrics2ThriftMetrics implements Metrics, MetricsSource {
+public class Metrics2ThriftMetrics implements Metrics, MetricsSource, ThriftMetricsKeys {
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
-  private final String name, desc;
+  private final String context, name, desc;
 
   Metrics2ThriftMetrics(MetricsSystem system, String serverName, String threadName) {
     this.system = system;
+    this.context = "thrift." + serverName;
     this.name = "ThriftMetrics" + serverName;
     this.desc = "Thrift Server Metrics - " + serverName + " " + threadName;
     this.registry = new MetricsRegistry(Interns.info(name, desc));
@@ -56,7 +57,7 @@ public class Metrics2ThriftMetrics implements Metrics, MetricsSource {
 
   @Override
   public void getMetrics(MetricsCollector collector, boolean all) {
-    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext("thrift");
+    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext(context);
 
     registry.snapshot(builder, all);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsFactory.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsFactory.java b/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsFactory.java
index 6a5a539..7c06971 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsFactory.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsFactory.java
@@ -27,7 +27,6 @@ import com.google.common.base.Preconditions;
  *
  */
 public class MetricsFactory {
-  public static final String METRICS_PREFIX = "Accumulo";
 
   private final boolean useOldMetrics;
   private final MetricsSystem metricsSystem;
@@ -39,7 +38,7 @@ public class MetricsFactory {
     if (useOldMetrics) {
       metricsSystem = null;
     } else {
-      metricsSystem = DefaultMetricsSystem.initialize(METRICS_PREFIX);
+      metricsSystem = DefaultMetricsSystem.initialize(Metrics.PREFIX);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/base/src/main/java/org/apache/accumulo/server/metrics/ThriftMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/metrics/ThriftMetricsMBean.java b/server/base/src/main/java/org/apache/accumulo/server/metrics/ThriftMetricsMBean.java
index 403cffe..101c7d7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/metrics/ThriftMetricsMBean.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/metrics/ThriftMetricsMBean.java
@@ -16,27 +16,24 @@
  */
 package org.apache.accumulo.server.metrics;
 
-public interface ThriftMetricsMBean {
-  
-  static final String idle = "idle";
-  static final String execute = "execute";
-  
+public interface ThriftMetricsMBean extends ThriftMetricsKeys {
+
   long getIdleCount();
-  
+
   long getIdleMinTime();
-  
+
   long getIdleMaxTime();
-  
+
   long getIdleAvgTime();
-  
+
   long getExecutionCount();
-  
+
   long getExecutionMinTime();
-  
+
   long getExecutionMaxTime();
-  
+
   long getExecutionAvgTime();
-  
+
   void reset();
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/master/src/main/java/org/apache/accumulo/master/metrics/MasterMetricsFactory.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/metrics/MasterMetricsFactory.java b/server/master/src/main/java/org/apache/accumulo/master/metrics/MasterMetricsFactory.java
index 606b85c..6d86d09 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/metrics/MasterMetricsFactory.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/metrics/MasterMetricsFactory.java
@@ -29,7 +29,6 @@ import com.google.common.base.Preconditions;
  *
  */
 public class MasterMetricsFactory {
-  public static final String METRICS_PREFIX = "Accumulo";
 
   private final boolean useOldMetrics;
   private final MetricsSystem metricsSystem;
@@ -43,7 +42,7 @@ public class MasterMetricsFactory {
     if (useOldMetrics) {
       metricsSystem = null;
     } else {
-      metricsSystem = DefaultMetricsSystem.initialize(METRICS_PREFIX);
+      metricsSystem = DefaultMetricsSystem.initialize(Metrics.PREFIX);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 11bfe15..8546c47 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -533,8 +533,8 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
         log.debug(String.format("ScanSess tid %s %s %,d entries in %.2f secs, nbTimes = [%s] ", TServerUtils.clientAddress.get(), ss.extent.getTableId()
             .toString(), ss.entriesReturned, (t2 - ss.startTime) / 1000.0, ss.nbTimes.toString()));
         if (scanMetrics.isEnabled()) {
-          scanMetrics.add(TabletServerScanMetrics.scan, t2 - ss.startTime);
-          scanMetrics.add(TabletServerScanMetrics.resultSize, ss.entriesReturned);
+          scanMetrics.add(TabletServerScanMetrics.SCAN, t2 - ss.startTime);
+          scanMetrics.add(TabletServerScanMetrics.RESULT_SIZE, ss.entriesReturned);
         }
       }
     }
@@ -656,7 +656,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
       Durability durability = DurabilityImpl.fromThrift(tdurabilty);
       security.authenticateUser(credentials, credentials);
       if (updateMetrics.isEnabled())
-        updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+        updateMetrics.add(TabletServerUpdateMetrics.PERMISSION_ERRORS, 0);
 
       UpdateSession us = new UpdateSession(new TservConstraintEnv(security, credentials), credentials, durability);
       long sid = sessionManager.createSession(us, false);
@@ -688,7 +688,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
             // failures
             us.failures.put(keyExtent, 0l);
             if (updateMetrics.isEnabled())
-              updateMetrics.add(TabletServerUpdateMetrics.unknownTabletErrors, 0);
+              updateMetrics.add(TabletServerUpdateMetrics.UNKNOWN_TABLET_ERRORS, 0);
           }
         } else {
           log.warn("Denying access to table " + keyExtent.getTableId() + " for user " + us.getUser());
@@ -697,7 +697,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
           us.currentTablet = null;
           us.authFailures.put(keyExtent, SecurityErrorCode.PERMISSION_DENIED);
           if (updateMetrics.isEnabled())
-            updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+            updateMetrics.add(TabletServerUpdateMetrics.PERMISSION_ERRORS, 0);
           return;
         }
       } catch (ThriftSecurityException e) {
@@ -707,7 +707,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
         us.currentTablet = null;
         us.authFailures.put(keyExtent, e.getCode());
         if (updateMetrics.isEnabled())
-          updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
+          updateMetrics.add(TabletServerUpdateMetrics.PERMISSION_ERRORS, 0);
         return;
       }
     }
@@ -769,7 +769,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
           if (mutations.size() > 0) {
             try {
               if (updateMetrics.isEnabled())
-                updateMetrics.add(TabletServerUpdateMetrics.mutationArraySize, mutations.size());
+                updateMetrics.add(TabletServerUpdateMetrics.MUTATION_ARRAY_SIZE, mutations.size());
 
               CommitSession commitSession = tablet.prepareMutationsForCommit(us.cenv, mutations);
               if (commitSession == null) {
@@ -785,7 +785,7 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
             } catch (TConstraintViolationException e) {
               us.violations.add(e.getViolations());
               if (updateMetrics.isEnabled())
-                updateMetrics.add(TabletServerUpdateMetrics.constraintViolations, 0);
+                updateMetrics.add(TabletServerUpdateMetrics.CONSTRAINT_VIOLATIONS, 0);
 
               if (e.getNonViolators().size() > 0) {
                 // only log and commit mutations if there were some
@@ -888,17 +888,17 @@ public class TabletServer extends AccumuloServerContext implements Runnable {
 
     private void updateWalogWriteTime(long time) {
       if (updateMetrics.isEnabled())
-        updateMetrics.add(TabletServerUpdateMetrics.waLogWriteTime, time);
+        updateMetrics.add(TabletServerUpdateMetrics.WALOG_WRITE_TIME, time);
     }
 
     private void updateAvgCommitTime(long time, int size) {
       if (updateMetrics.isEnabled())
-        updateMetrics.add(TabletServerUpdateMetrics.commitTime, (long) ((time) / (double) size));
+        updateMetrics.add(TabletServerUpdateMetrics.COMMIT_TIME, (long) ((time) / (double) size));
     }
 
     private void updateAvgPrepTime(long time, int size) {
       if (updateMetrics.isEnabled())
-        updateMetrics.add(TabletServerUpdateMetrics.commitPrep, (long) ((time) / (double) size));
+        updateMetrics.add(TabletServerUpdateMetrics.COMMIT_PREP, (long) ((time) / (double) size));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMetrics.java
index 8d47ba7..1ab2319 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMetrics.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.tserver.metrics;
 
 import org.apache.accumulo.server.metrics.Metrics;
 import org.apache.accumulo.tserver.TabletServer;
-import org.apache.accumulo.tserver.tablet.Tablet;
 import org.apache.hadoop.metrics2.MetricsCollector;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
 import org.apache.hadoop.metrics2.MetricsSource;
@@ -26,30 +25,25 @@ import org.apache.hadoop.metrics2.MetricsSystem;
 import org.apache.hadoop.metrics2.lib.Interns;
 import org.apache.hadoop.metrics2.lib.MetricsRegistry;
 import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
-import org.apache.hadoop.metrics2.lib.MutableStat;
 
 /**
  *
  */
-public class Metrics2TabletServerMetrics implements Metrics, MetricsSource {
-  public static final String ENTRIES = "entries", ENTRIES_IN_MEM = "entriesInMem", HOLD_TIME = "holdTime", FILES_PER_TABLET = "filesPerTablet",
-      ACTIVE_MAJCS = "activeMajCs", QUEUED_MAJCS = "queuedMajCs", ACTIVE_MINCS = "activeMinCs", QUEUED_MINCS = "queuedMinCs", ONLINE_TABLETS = "onlineTablets",
-      OPENING_TABLETS = "openingTablets", UNOPENED_TABLETS = "unopenedTablets", QUERIES = "queries", TOTAL_MINCS = "totalMinCs";
+public class Metrics2TabletServerMetrics implements Metrics, MetricsSource, TabletServerMetricsKeys {
+  public static final String NAME = "TabletServerMetrics", DESCRIPTION = "General TabletServer Metrics", CONTEXT = "tserver";
 
-  private final TabletServer tserver;
+  private final TabletServerMetricsUtil util;
   private final MetricsSystem system;
   private final MetricsRegistry registry;
 
-  private final MutableStat filesPerTablet;
   private final MutableGaugeLong entries, entriesInMemory, activeMajcs, queuedMajcs, activeMincs, queuedMincs, onlineTablets, openingTablets, unopenedTablets,
       queries, totalMincs;
 
+  // Use TabletServerMetricsFactory
   Metrics2TabletServerMetrics(TabletServer tserver, MetricsSystem system) {
-    this.tserver = tserver;
+    util = new TabletServerMetricsUtil(tserver);
     this.system = system;
-    this.registry = new MetricsRegistry(Interns.info("TabletServerMetrics", "General TabletServer Metrics"));
-
-    filesPerTablet = registry.newStat(FILES_PER_TABLET, "Number of files per tablet", "Ops", "Files", true);
+    this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 
     entries = registry.newGauge(Interns.info(ENTRIES, "Number of entries"), 0l);
     entriesInMemory = registry.newGauge(Interns.info(ENTRIES_IN_MEM, "Number of entries in memory"), 0l);
@@ -71,7 +65,7 @@ public class Metrics2TabletServerMetrics implements Metrics, MetricsSource {
 
   @Override
   public void register() {
-    system.register("TabletServerMetrics", "General TabletServer Metrics", this);
+    system.register(NAME, DESCRIPTION, this);
   }
 
   @Override
@@ -80,24 +74,23 @@ public class Metrics2TabletServerMetrics implements Metrics, MetricsSource {
   }
 
   protected void snapshot() {
-    filesPerTablet.add((long) getAverageFilesPerTablet());
-
-    entries.set(getEntries());
-    entriesInMemory.set(getEntriesInMemory());
-    activeMajcs.set(getMajorCompactions());
-    queuedMajcs.set(getMajorCompactionsQueued());
-    activeMincs.set(getMinorCompactions());
-    queuedMincs.set(getMinorCompactionsQueued());
-    onlineTablets.set(getOnlineCount());
-    openingTablets.set(getOpeningCount());
-    unopenedTablets.set(getUnopenedCount());
-    queries.set(getQueries());
-    totalMincs.set(getTotalMinorCompactions());
+
+    entries.set(util.getEntries());
+    entriesInMemory.set(util.getEntriesInMemory());
+    activeMajcs.set(util.getMajorCompactions());
+    queuedMajcs.set(util.getMajorCompactionsQueued());
+    activeMincs.set(util.getMinorCompactions());
+    queuedMincs.set(util.getMinorCompactionsQueued());
+    onlineTablets.set(util.getOnlineCount());
+    openingTablets.set(util.getOpeningCount());
+    unopenedTablets.set(util.getUnopenedCount());
+    queries.set(util.getQueries());
+    totalMincs.set(util.getTotalMinorCompactions());
   }
 
   @Override
   public void getMetrics(MetricsCollector collector, boolean all) {
-    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext("tserver");
+    MetricsRecordBuilder builder = collector.addRecord(PREFIX).setContext(CONTEXT);
 
     // Update each MutableMetric with the new value
     snapshot();
@@ -106,110 +99,8 @@ public class Metrics2TabletServerMetrics implements Metrics, MetricsSource {
     registry.snapshot(builder, all);
 
     // TODO Some day, MetricsRegistry will also support the MetricsGaugeDouble or allow us to instantiate it directly
-    builder.addGauge(Interns.info(HOLD_TIME, "Time commits held"), getHoldTime());
-  }
-
-  public long getEntries() {
-    long result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      result += tablet.getNumEntries();
-    }
-    return result;
-  }
-
-  public long getEntriesInMemory() {
-    long result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      result += tablet.getNumEntriesInMemory();
-    }
-    return result;
-  }
-
-  public long getIngest() {
-    long result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      result += tablet.getNumEntriesInMemory();
-    }
-    return result;
-  }
-
-  public int getMajorCompactions() {
-    int result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      if (tablet.isMajorCompactionRunning())
-        result++;
-    }
-    return result;
-  }
-
-  public int getMajorCompactionsQueued() {
-    int result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      if (tablet.isMajorCompactionQueued())
-        result++;
-    }
-    return result;
-  }
-
-  public int getMinorCompactions() {
-    int result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      if (tablet.isMinorCompactionRunning())
-        result++;
-    }
-    return result;
-  }
-
-  public int getMinorCompactionsQueued() {
-    int result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      if (tablet.isMinorCompactionQueued())
-        result++;
-    }
-    return result;
+    builder.addGauge(Interns.info(FILES_PER_TABLET, "Number of files per tablet"), util.getAverageFilesPerTablet());
+    builder.addGauge(Interns.info(HOLD_TIME, "Time commits held"), util.getHoldTime());
   }
 
-  public int getOnlineCount() {
-    return tserver.getOnlineTablets().size();
-  }
-
-  public int getOpeningCount() {
-    return tserver.getOpeningCount();
-  }
-
-  public long getQueries() {
-    long result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      result += tablet.totalQueries();
-    }
-    return result;
-  }
-
-  public int getUnopenedCount() {
-    return tserver.getUnopenedCount();
-  }
-
-  public String getName() {
-    return tserver.getClientAddressString();
-  }
-
-  public long getTotalMinorCompactions() {
-    return tserver.getTotalMinorCompactions();
-  }
-
-  public double getHoldTime() {
-    return tserver.getHoldTimeMillis() / 1000.;
-  }
-
-  public double getAverageFilesPerTablet() {
-    int count = 0;
-    long result = 0;
-    for (Tablet tablet : tserver.getOnlineTablets()) {
-      result += tablet.getDatafiles().size();
-      count++;
-    }
-    if (count == 0)
-      return 0;
-    return result / (double) count;
-  }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMinCMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMinCMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMinCMetrics.java
index 8facaeb..11af88b 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMinCMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerMinCMetrics.java
@@ -28,32 +28,34 @@ import org.apache.hadoop.metrics2.lib.MutableStat;
 /**
  *
  */
-public class Metrics2TabletServerMinCMetrics implements Metrics, MetricsSource {
+public class Metrics2TabletServerMinCMetrics implements Metrics, MetricsSource, TabletServerMinCMetricsKeys {
+  public static final String NAME = "MinorCompactionMetrics", DESCRIPTION = "TabletServer Minor Compaction Metrics", CONTEXT = "tserver.minc";
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
   private final MutableStat activeMinc, queuedMinc;
 
-  public Metrics2TabletServerMinCMetrics(MetricsSystem system) {
+  // Use TabletServerMetricsFactory
+  Metrics2TabletServerMinCMetrics(MetricsSystem system) {
     this.system = system;
-    this.registry = new MetricsRegistry(Interns.info("MinorCompactionMetrics", "TabletServer Minor Compaction Metrics"));
-    
-    activeMinc = registry.newStat(TabletServerMinCMetricsMBean.minc, "Minor compactions", "Ops", "Count", true);
-    queuedMinc = registry.newStat(TabletServerMinCMetricsMBean.queue, "Queued minor compactions", "Ops", "Count", true);
+    this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
+
+    activeMinc = registry.newStat(MINC, "Minor compactions", "Ops", "Count", true);
+    queuedMinc = registry.newStat(QUEUE, "Queued minor compactions", "Ops", "Count", true);
   }
 
   @Override
   public void add(String name, long value) {
-    if (TabletServerMinCMetricsMBean.minc.equals(name)) {
+    if (MINC.equals(name)) {
       activeMinc.add(value);
-    } else if (TabletServerMinCMetricsMBean.queue.equals(name)) {
+    } else if (QUEUE.equals(name)) {
       queuedMinc.add(value);
     }
   }
 
   @Override
   public void register() {
-    system.register("MinorCompactionMetrics", "TabletServer Minor Compaction Metrics", this);
+    system.register(NAME, DESCRIPTION, this);
   }
 
   @Override
@@ -63,7 +65,7 @@ public class Metrics2TabletServerMinCMetrics implements Metrics, MetricsSource {
 
   @Override
   public void getMetrics(MetricsCollector collector, boolean all) {
-    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext("tserver.minc");
+    MetricsRecordBuilder builder = collector.addRecord(PREFIX).setContext(CONTEXT);
 
     registry.snapshot(builder, all);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerScanMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerScanMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerScanMetrics.java
index e2ab687..bca7f9c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerScanMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerScanMetrics.java
@@ -28,25 +28,27 @@ import org.apache.hadoop.metrics2.lib.MutableStat;
 /**
  *
  */
-public class Metrics2TabletServerScanMetrics implements Metrics, MetricsSource {
+public class Metrics2TabletServerScanMetrics implements Metrics, MetricsSource, TabletServerScanMetricsKeys {
+  public static final String NAME = "ScanMetrics", DESCRIPTION = "TabletServer Scan Metrics", CONTEXT = "tserver.scan";
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
   private final MutableStat scans, resultsPerScan;
 
+  // Use TabletServerMetricsFactory
   Metrics2TabletServerScanMetrics(MetricsSystem system) {
     this.system = system;
-    this.registry = new MetricsRegistry(Interns.info("ScanMetrics", "TabletServer Scan Metrics"));
+    this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 
-    scans = registry.newStat(TabletServerScanMetricsMBean.scan, "Scans", "Ops", "Count", true);
-    resultsPerScan = registry.newStat(TabletServerScanMetricsMBean.resultSize, "Results per scan", "Ops", "Count", true);
+    scans = registry.newStat(SCAN, "Scans", "Ops", "Count", true);
+    resultsPerScan = registry.newStat(RESULT_SIZE, "Results per scan", "Ops", "Count", true);
   }
 
   @Override
   public void add(String name, long value) {
-    if (TabletServerScanMetricsMBean.scan.equals(name)) {
+    if (SCAN.equals(name)) {
       scans.add(value);
-    } else if (TabletServerScanMetricsMBean.resultSize.equals(name)) {
+    } else if (RESULT_SIZE.equals(name)) {
       resultsPerScan.add(value);
     } else {
       throw new RuntimeException("Could not find metric to update for name " + name);
@@ -55,7 +57,7 @@ public class Metrics2TabletServerScanMetrics implements Metrics, MetricsSource {
 
   @Override
   public void register() {
-    system.register("ScanMetrics", "TabletServer Scan Metrics", this);
+    system.register(NAME, DESCRIPTION, this);
   }
 
   @Override
@@ -65,7 +67,7 @@ public class Metrics2TabletServerScanMetrics implements Metrics, MetricsSource {
 
   @Override
   public void getMetrics(MetricsCollector collector, boolean all) {
-    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext("tserver.scan");
+    MetricsRecordBuilder builder = collector.addRecord(PREFIX).setContext(CONTEXT);
 
     registry.snapshot(builder, all);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerUpdateMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerUpdateMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerUpdateMetrics.java
index f883b60..916c616 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerUpdateMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/Metrics2TabletServerUpdateMetrics.java
@@ -29,44 +29,46 @@ import org.apache.hadoop.metrics2.lib.MutableStat;
 /**
  *
  */
-public class Metrics2TabletServerUpdateMetrics implements Metrics, MetricsSource {
+public class Metrics2TabletServerUpdateMetrics implements Metrics, MetricsSource, TabletServerUpdateMetricsKeys {
+  public static final String NAME = "UpdateMetrics", DESCRIPTION = "TabletServer Update Metrics", CONTEXT = "tserver.update";
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
 
-  private final MutableCounterLong permissionErrors, unknownTabletErrors, constraintViolations;
-  private final MutableStat commitPrep, walogWriteTime, commitTime, mutationArraySize;
+  private final MutableCounterLong permissionErrorsCounter, unknownTabletErrorsCounter, constraintViolationsCounter;
+  private final MutableStat commitPrepStat, walogWriteTimeStat, commitTimeStat, mutationArraySizeStat;
 
-  public Metrics2TabletServerUpdateMetrics(MetricsSystem system) {
+  // Use TabletServerMetricsFactory
+  Metrics2TabletServerUpdateMetrics(MetricsSystem system) {
     this.system = system;
-    this.registry = new MetricsRegistry(Interns.info("UpdateMetrics", "TabletServer Update Metrics"));
+    this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 
-    permissionErrors = registry.newCounter(Interns.info(TabletServerUpdateMetricsMBean.permissionErrors, "Permission Errors"), 0l);
-    unknownTabletErrors = registry.newCounter(Interns.info(TabletServerUpdateMetricsMBean.unknownTabletErrors, "Unknown Tablet Errors"), 0l);
-    constraintViolations = registry.newCounter(Interns.info(TabletServerUpdateMetricsMBean.constraintViolations, "Table Constraint Violations"), 0l);
+    permissionErrorsCounter = registry.newCounter(Interns.info(PERMISSION_ERRORS, "Permission Errors"), 0l);
+    unknownTabletErrorsCounter = registry.newCounter(Interns.info(UNKNOWN_TABLET_ERRORS, "Unknown Tablet Errors"), 0l);
+    constraintViolationsCounter = registry.newCounter(Interns.info(CONSTRAINT_VIOLATIONS, "Table Constraint Violations"), 0l);
 
-    commitPrep = registry.newStat(TabletServerUpdateMetricsMBean.commitPrep, "preparing to commit mutations", "Ops", "Time", true);
-    walogWriteTime = registry.newStat(TabletServerUpdateMetricsMBean.waLogWriteTime, "writing mutations to WAL", "Ops", "Time", true);
-    commitTime = registry.newStat(TabletServerUpdateMetricsMBean.commitTime, "committing mutations", "Ops", "Time", true);
-    mutationArraySize = registry.newStat(TabletServerUpdateMetricsMBean.mutationArraySize, "mutation array", "ops", "Size", true);
+    commitPrepStat = registry.newStat(COMMIT_PREP, "preparing to commit mutations", "Ops", "Time", true);
+    walogWriteTimeStat = registry.newStat(WALOG_WRITE_TIME, "writing mutations to WAL", "Ops", "Time", true);
+    commitTimeStat = registry.newStat(COMMIT_TIME, "committing mutations", "Ops", "Time", true);
+    mutationArraySizeStat = registry.newStat(MUTATION_ARRAY_SIZE, "mutation array", "ops", "Size", true);
   }
 
   @Override
   public void add(String name, long value) {
-    if (TabletServerUpdateMetricsMBean.permissionErrors.equals(name)) {
-      permissionErrors.incr(value);
-    } else if (TabletServerUpdateMetricsMBean.unknownTabletErrors.equals(name)) {
-      unknownTabletErrors.incr(value);
-    } else if (TabletServerUpdateMetricsMBean.mutationArraySize.equals(name)) {
-      mutationArraySize.add(value);
-    } else if (TabletServerUpdateMetricsMBean.commitPrep.equals(name)) {
-      commitPrep.add(value);
-    } else if (TabletServerUpdateMetricsMBean.constraintViolations.equals(name)) {
-      constraintViolations.incr(value);
-    } else if (TabletServerUpdateMetricsMBean.waLogWriteTime.equals(name)) {
-      walogWriteTime.add(value);
-    } else if (TabletServerUpdateMetricsMBean.commitTime.equals(name)) {
-      commitTime.add(value);
+    if (PERMISSION_ERRORS.equals(name)) {
+      permissionErrorsCounter.incr(value);
+    } else if (UNKNOWN_TABLET_ERRORS.equals(name)) {
+      unknownTabletErrorsCounter.incr(value);
+    } else if (MUTATION_ARRAY_SIZE.equals(name)) {
+      mutationArraySizeStat.add(value);
+    } else if (COMMIT_PREP.equals(name)) {
+      commitPrepStat.add(value);
+    } else if (CONSTRAINT_VIOLATIONS.equals(name)) {
+      constraintViolationsCounter.incr(value);
+    } else if (WALOG_WRITE_TIME.equals(name)) {
+      walogWriteTimeStat.add(value);
+    } else if (COMMIT_TIME.equals(name)) {
+      commitTimeStat.add(value);
     } else {
       throw new RuntimeException("Cannot process metric with name " + name);
     }
@@ -74,7 +76,7 @@ public class Metrics2TabletServerUpdateMetrics implements Metrics, MetricsSource
 
   @Override
   public void register() {
-    system.register("UpdateMetrics", "TabletServer Update Metrics", this);
+    system.register(NAME, DESCRIPTION, this);
   }
 
   @Override
@@ -84,7 +86,7 @@ public class Metrics2TabletServerUpdateMetrics implements Metrics, MetricsSource
 
   @Override
   public void getMetrics(MetricsCollector collector, boolean all) {
-    MetricsRecordBuilder builder = collector.addRecord("Accumulo").setContext("tserver.update");
+    MetricsRecordBuilder builder = collector.addRecord(PREFIX).setContext(CONTEXT);
 
     registry.snapshot(builder, all);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
index 8ba853f..b472065 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
@@ -22,7 +22,6 @@ import javax.management.StandardMBean;
 
 import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
 import org.apache.accumulo.tserver.TabletServer;
-import org.apache.accumulo.tserver.tablet.Tablet;
 import org.apache.log4j.Logger;
 
 public class TabletServerMBeanImpl extends AbstractMetricsImpl implements TabletServerMBean {
@@ -30,10 +29,10 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   private static final String METRICS_PREFIX = "tserver";
   private static ObjectName OBJECT_NAME = null;
 
-  final TabletServer server;
+  private final TabletServerMetricsUtil util;
 
   TabletServerMBeanImpl(TabletServer server) {
-    this.server = server;
+    util = new TabletServerMetricsUtil(server);
     try {
       OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerMBean,instance=" + Thread.currentThread().getName());
     } catch (MalformedObjectNameException e) {
@@ -51,11 +50,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public long getEntries() {
     if (isEnabled()) {
-      long result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        result += tablet.getNumEntries();
-      }
-      return result;
+      return util.getEntries();
     }
     return 0;
   }
@@ -63,11 +58,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public long getEntriesInMemory() {
     if (isEnabled()) {
-      long result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        result += tablet.getNumEntriesInMemory();
-      }
-      return result;
+      return util.getEntriesInMemory();
     }
     return 0;
   }
@@ -75,11 +66,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public long getIngest() {
     if (isEnabled()) {
-      long result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        result += tablet.getNumEntriesInMemory();
-      }
-      return result;
+      return util.getIngest();
     }
     return 0;
   }
@@ -87,12 +74,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getMajorCompactions() {
     if (isEnabled()) {
-      int result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        if (tablet.isMajorCompactionRunning())
-          result++;
-      }
-      return result;
+      return util.getMajorCompactions();
     }
     return 0;
   }
@@ -100,12 +82,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getMajorCompactionsQueued() {
     if (isEnabled()) {
-      int result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        if (tablet.isMajorCompactionQueued())
-          result++;
-      }
-      return result;
+      return util.getMajorCompactionsQueued();
     }
     return 0;
   }
@@ -113,12 +90,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getMinorCompactions() {
     if (isEnabled()) {
-      int result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        if (tablet.isMinorCompactionRunning())
-          result++;
-      }
-      return result;
+      return util.getMinorCompactions();
     }
     return 0;
   }
@@ -126,12 +98,7 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getMinorCompactionsQueued() {
     if (isEnabled()) {
-      int result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        if (tablet.isMinorCompactionQueued())
-          result++;
-      }
-      return result;
+      return util.getMinorCompactionsQueued();
     }
     return 0;
   }
@@ -139,25 +106,21 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getOnlineCount() {
     if (isEnabled())
-      return server.getOnlineTablets().size();
+      return util.getOnlineCount();
     return 0;
   }
 
   @Override
   public int getOpeningCount() {
     if (isEnabled())
-      return server.getOpeningCount();
+      return util.getOpeningCount();
     return 0;
   }
 
   @Override
   public long getQueries() {
     if (isEnabled()) {
-      long result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        result += tablet.totalQueries();
-      }
-      return result;
+      return util.getQueries();
     }
     return 0;
   }
@@ -165,43 +128,35 @@ public class TabletServerMBeanImpl extends AbstractMetricsImpl implements Tablet
   @Override
   public int getUnopenedCount() {
     if (isEnabled())
-      return server.getUnopenedCount();
+      return util.getUnopenedCount();
     return 0;
   }
 
   @Override
   public String getName() {
     if (isEnabled())
-      return server.getClientAddressString();
+      return util.getName();
     return "";
   }
 
   @Override
   public long getTotalMinorCompactions() {
     if (isEnabled())
-      return server.getTotalMinorCompactions();
+      return util.getTotalMinorCompactions();
     return 0;
   }
 
   @Override
   public double getHoldTime() {
     if (isEnabled())
-      return server.getHoldTimeMillis() / 1000.;
+      return util.getHoldTime();
     return 0;
   }
 
   @Override
   public double getAverageFilesPerTablet() {
     if (isEnabled()) {
-      int count = 0;
-      long result = 0;
-      for (Tablet tablet : server.getOnlineTablets()) {
-        result += tablet.getDatafiles().size();
-        count++;
-      }
-      if (count == 0)
-        return 0;
-      return result / (double) count;
+      return util.getAverageFilesPerTablet();
     }
     return 0;
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsFactory.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsFactory.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsFactory.java
index c799feb..7ca9486 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsFactory.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsFactory.java
@@ -26,10 +26,11 @@ import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import com.google.common.base.Preconditions;
 
 /**
+ * Factory to create Metrics instances for various TabletServer functions.
  *
+ * Necessary shim to support both the custom JMX metrics from &lt;1.7.0 and the new Hadoop Metrics2 implementations.
  */
 public class TabletServerMetricsFactory {
-  public static final String METRICS_PREFIX = "Accumulo";
 
   private final boolean useOldMetrics;
   private final MetricsSystem metricsSystem;
@@ -41,10 +42,13 @@ public class TabletServerMetricsFactory {
     if (useOldMetrics) {
       metricsSystem = null;
     } else {
-      metricsSystem = DefaultMetricsSystem.initialize(METRICS_PREFIX);
+      metricsSystem = DefaultMetricsSystem.initialize(Metrics.PREFIX);
     }
   }
 
+  /**
+   * Create Metrics to track MinorCompactions
+   */
   public Metrics createMincMetrics() {
     if (useOldMetrics) {
       return new TabletServerMinCMetrics();
@@ -53,6 +57,9 @@ public class TabletServerMetricsFactory {
     return new Metrics2TabletServerMinCMetrics(metricsSystem);
   }
 
+  /**
+   * Create Metrics to track TabletServer state
+   */
   public Metrics createTabletServerMetrics(TabletServer tserver) {
     if (useOldMetrics) {
       return new TabletServerMBeanImpl(tserver);
@@ -61,6 +68,9 @@ public class TabletServerMetricsFactory {
     return new Metrics2TabletServerMetrics(tserver, metricsSystem);
   }
 
+  /**
+   * Create Metrics to track scans
+   */
   public Metrics createScanMetrics() {
     if (useOldMetrics) {
       return new TabletServerScanMetrics();
@@ -69,6 +79,9 @@ public class TabletServerMetricsFactory {
     return new Metrics2TabletServerScanMetrics(metricsSystem);
   }
 
+  /**
+   * Create Metrics to track updates (writes)
+   */
   public Metrics createUpdateMetrics() {
     if (useOldMetrics) {
       return new TabletServerUpdateMetrics();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
index 733cee9..f4d61ca 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
@@ -50,42 +50,42 @@ public class TabletServerMinCMetrics extends AbstractMetricsImpl implements Tabl
 
   @Override
   public long getMinorCompactionMinTime() {
-    return this.getMetricMin(minc);
+    return this.getMetricMin(MINC);
   }
 
   @Override
   public long getMinorCompactionAvgTime() {
-    return this.getMetricAvg(minc);
+    return this.getMetricAvg(MINC);
   }
 
   @Override
   public long getMinorCompactionCount() {
-    return this.getMetricCount(minc);
+    return this.getMetricCount(MINC);
   }
 
   @Override
   public long getMinorCompactionMaxTime() {
-    return this.getMetricMax(minc);
+    return this.getMetricMax(MINC);
   }
 
   @Override
   public long getMinorCompactionQueueAvgTime() {
-    return this.getMetricAvg(queue);
+    return this.getMetricAvg(QUEUE);
   }
 
   @Override
   public long getMinorCompactionQueueCount() {
-    return this.getMetricCount(queue);
+    return this.getMetricCount(QUEUE);
   }
 
   @Override
   public long getMinorCompactionQueueMaxTime() {
-    return this.getMetricMax(queue);
+    return this.getMetricMax(QUEUE);
   }
 
   @Override
   public long getMinorCompactionQueueMinTime() {
-    return this.getMetricMin(minc);
+    return this.getMetricMin(MINC);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
index 0dc6cf3..2af820c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
@@ -16,27 +16,24 @@
  */
 package org.apache.accumulo.tserver.metrics;
 
-public interface TabletServerMinCMetricsMBean {
-  
-  static final String minc = "minc";
-  static final String queue = "queue";
-  
+public interface TabletServerMinCMetricsMBean extends TabletServerMinCMetricsKeys {
+
   long getMinorCompactionCount();
-  
+
   long getMinorCompactionAvgTime();
-  
+
   long getMinorCompactionMinTime();
-  
+
   long getMinorCompactionMaxTime();
-  
+
   long getMinorCompactionQueueCount();
-  
+
   long getMinorCompactionQueueAvgTime();
-  
+
   long getMinorCompactionQueueMinTime();
-  
+
   long getMinorCompactionQueueMaxTime();
-  
+
   void reset();
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
index 17d33a8..6bcabfd 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
@@ -50,48 +50,48 @@ public class TabletServerScanMetrics extends AbstractMetricsImpl implements Tabl
 
   @Override
   public long getResultAvgSize() {
-    return this.getMetricAvg(resultSize);
+    return this.getMetricAvg(RESULT_SIZE);
   }
 
   @Override
   public long getResultCount() {
-    return this.getMetricCount(resultSize);
+    return this.getMetricCount(RESULT_SIZE);
   }
 
   @Override
   public long getResultMaxSize() {
-    return this.getMetricMax(resultSize);
+    return this.getMetricMax(RESULT_SIZE);
   }
 
   @Override
   public long getResultMinSize() {
-    return this.getMetricMin(resultSize);
+    return this.getMetricMin(RESULT_SIZE);
   }
 
   @Override
   public long getScanAvgTime() {
-    return this.getMetricAvg(scan);
+    return this.getMetricAvg(SCAN);
   }
 
   @Override
   public long getScanCount() {
-    return this.getMetricCount(scan);
+    return this.getMetricCount(SCAN);
   }
 
   @Override
   public long getScanMaxTime() {
-    return this.getMetricMax(scan);
+    return this.getMetricMax(SCAN);
   }
 
   @Override
   public long getScanMinTime() {
-    return this.getMetricMin(scan);
+    return this.getMetricMin(SCAN);
   }
 
   @Override
   public void reset() {
-    createMetric(scan);
-    createMetric(resultSize);
+    createMetric(SCAN);
+    createMetric(RESULT_SIZE);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
index b532cfa..e262fc4 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
@@ -16,27 +16,24 @@
  */
 package org.apache.accumulo.tserver.metrics;
 
-public interface TabletServerScanMetricsMBean {
-  
-  static final String scan = "scan";
-  static final String resultSize = "result";
-  
+public interface TabletServerScanMetricsMBean extends TabletServerScanMetricsKeys {
+
   long getScanCount();
-  
+
   long getScanAvgTime();
-  
+
   long getScanMinTime();
-  
+
   long getScanMaxTime();
-  
+
   long getResultCount();
-  
+
   long getResultAvgSize();
-  
+
   long getResultMinSize();
-  
+
   long getResultMaxSize();
-  
+
   void reset();
-  
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
index bb38655..48b78b0 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
@@ -51,103 +51,103 @@ public class TabletServerUpdateMetrics extends AbstractMetricsImpl implements Ta
 
   @Override
   public long getPermissionErrorCount() {
-    return this.getMetricCount(permissionErrors);
+    return this.getMetricCount(PERMISSION_ERRORS);
   }
 
   @Override
   public long getUnknownTabletErrorCount() {
-    return this.getMetricCount(unknownTabletErrors);
+    return this.getMetricCount(UNKNOWN_TABLET_ERRORS);
   }
 
   @Override
   public long getMutationArrayAvgSize() {
-    return this.getMetricAvg(mutationArraySize);
+    return this.getMetricAvg(MUTATION_ARRAY_SIZE);
   }
 
   @Override
   public long getMutationArrayMinSize() {
-    return this.getMetricMin(mutationArraySize);
+    return this.getMetricMin(MUTATION_ARRAY_SIZE);
   }
 
   @Override
   public long getMutationArrayMaxSize() {
-    return this.getMetricMax(mutationArraySize);
+    return this.getMetricMax(MUTATION_ARRAY_SIZE);
   }
 
   @Override
   public long getCommitPrepCount() {
-    return this.getMetricCount(commitPrep);
+    return this.getMetricCount(COMMIT_PREP);
   }
 
   @Override
   public long getCommitPrepMinTime() {
-    return this.getMetricMin(commitPrep);
+    return this.getMetricMin(COMMIT_PREP);
   }
 
   @Override
   public long getCommitPrepMaxTime() {
-    return this.getMetricMax(commitPrep);
+    return this.getMetricMax(COMMIT_PREP);
   }
 
   @Override
   public long getCommitPrepAvgTime() {
-    return this.getMetricAvg(commitPrep);
+    return this.getMetricAvg(COMMIT_PREP);
   }
 
   @Override
   public long getConstraintViolationCount() {
-    return this.getMetricCount(constraintViolations);
+    return this.getMetricCount(CONSTRAINT_VIOLATIONS);
   }
 
   @Override
   public long getWALogWriteCount() {
-    return this.getMetricCount(waLogWriteTime);
+    return this.getMetricCount(WALOG_WRITE_TIME);
   }
 
   @Override
   public long getWALogWriteMinTime() {
-    return this.getMetricMin(waLogWriteTime);
+    return this.getMetricMin(WALOG_WRITE_TIME);
   }
 
   @Override
   public long getWALogWriteMaxTime() {
-    return this.getMetricMax(waLogWriteTime);
+    return this.getMetricMax(WALOG_WRITE_TIME);
   }
 
   @Override
   public long getWALogWriteAvgTime() {
-    return this.getMetricAvg(waLogWriteTime);
+    return this.getMetricAvg(WALOG_WRITE_TIME);
   }
 
   @Override
   public long getCommitCount() {
-    return this.getMetricCount(commitTime);
+    return this.getMetricCount(COMMIT_TIME);
   }
 
   @Override
   public long getCommitMinTime() {
-    return this.getMetricMin(commitTime);
+    return this.getMetricMin(COMMIT_TIME);
   }
 
   @Override
   public long getCommitMaxTime() {
-    return this.getMetricMax(commitTime);
+    return this.getMetricMax(COMMIT_TIME);
   }
 
   @Override
   public long getCommitAvgTime() {
-    return this.getMetricAvg(commitTime);
+    return this.getMetricAvg(COMMIT_TIME);
   }
 
   @Override
   public void reset() {
-    createMetric(permissionErrors);
-    createMetric(unknownTabletErrors);
-    createMetric(mutationArraySize);
-    createMetric(commitPrep);
-    createMetric(constraintViolations);
-    createMetric(waLogWriteTime);
-    createMetric(commitTime);
+    createMetric(PERMISSION_ERRORS);
+    createMetric(UNKNOWN_TABLET_ERRORS);
+    createMetric(MUTATION_ARRAY_SIZE);
+    createMetric(COMMIT_PREP);
+    createMetric(CONSTRAINT_VIOLATIONS);
+    createMetric(WALOG_WRITE_TIME);
+    createMetric(COMMIT_TIME);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
index 0292947..867f2f7 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
@@ -16,51 +16,43 @@
  */
 package org.apache.accumulo.tserver.metrics;
 
-public interface TabletServerUpdateMetricsMBean {
-  
-  final static String permissionErrors = "permissionErrors";
-  final static String unknownTabletErrors = "unknownTabletErrors";
-  final static String mutationArraySize = "mutationArraysSize";
-  final static String commitPrep = "commitPrep";
-  final static String constraintViolations = "constraintViolations";
-  final static String waLogWriteTime = "waLogWriteTime";
-  final static String commitTime = "commitTime";
-  
+public interface TabletServerUpdateMetricsMBean extends TabletServerUpdateMetricsKeys {
+
   long getPermissionErrorCount();
-  
+
   long getUnknownTabletErrorCount();
-  
+
   long getMutationArrayAvgSize();
-  
+
   long getMutationArrayMinSize();
-  
+
   long getMutationArrayMaxSize();
-  
+
   long getCommitPrepCount();
-  
+
   long getCommitPrepMinTime();
-  
+
   long getCommitPrepMaxTime();
-  
+
   long getCommitPrepAvgTime();
-  
+
   long getConstraintViolationCount();
-  
+
   long getWALogWriteCount();
-  
+
   long getWALogWriteMinTime();
-  
+
   long getWALogWriteMaxTime();
-  
+
   long getWALogWriteAvgTime();
-  
+
   long getCommitCount();
-  
+
   long getCommitMinTime();
-  
+
   long getCommitMaxTime();
-  
+
   long getCommitAvgTime();
-  
+
   void reset();
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/43df5e7f/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 63bf1bf..288f66e 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -974,11 +974,11 @@ public class Tablet implements TabletCommitter {
       }
       Metrics minCMetrics = getTabletServer().getMinCMetrics();
       if (minCMetrics.isEnabled())
-        minCMetrics.add(TabletServerMinCMetrics.minc, (lastMinorCompactionFinishTime - start));
+        minCMetrics.add(TabletServerMinCMetrics.MINC, (lastMinorCompactionFinishTime - start));
       if (hasQueueTime) {
         timer.updateTime(Operation.MINOR, queued, start, count, failed);
         if (minCMetrics.isEnabled())
-          minCMetrics.add(TabletServerMinCMetrics.queue, (start - queued));
+          minCMetrics.add(TabletServerMinCMetrics.QUEUE, (start - queued));
       } else
         timer.updateTime(Operation.MINOR, start, count, failed);
     }


Mime
View raw message