accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] accumulo git commit: Port over minc and scan metrics to use extended MutableStats
Date Thu, 04 Dec 2014 18:24:51 GMT
Repository: accumulo
Updated Branches:
  refs/heads/metrics2-backwardscompat f3f8dc467 -> e199f1b1d


Port over minc and scan metrics to use extended MutableStats


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

Branch: refs/heads/metrics2-backwardscompat
Commit: f01370d3da59f5dca77bf232117e67ae6001a031
Parents: f3f8dc4
Author: Josh Elser <elserj@apache.org>
Authored: Thu Dec 4 13:09:26 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Dec 4 13:09:26 2014 -0500

----------------------------------------------------------------------
 .../metrics/Metrics2TabletServerMinCMetrics.java     | 13 +++++++++++--
 .../metrics/Metrics2TabletServerScanMetrics.java     | 15 +++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f01370d3/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 f152d48..8facaeb 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
@@ -23,6 +23,7 @@ import org.apache.hadoop.metrics2.MetricsSource;
 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.MutableStat;
 
 /**
  *
@@ -31,15 +32,23 @@ public class Metrics2TabletServerMinCMetrics implements Metrics, MetricsSource
{
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
+  private final MutableStat activeMinc, queuedMinc;
 
   public 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);
   }
 
   @Override
-  public void add(String name, long time) {
-    registry.add(name, time);
+  public void add(String name, long value) {
+    if (TabletServerMinCMetricsMBean.minc.equals(name)) {
+      activeMinc.add(value);
+    } else if (TabletServerMinCMetricsMBean.queue.equals(name)) {
+      queuedMinc.add(value);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f01370d3/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 d54e689..e2ab687 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
@@ -23,6 +23,7 @@ import org.apache.hadoop.metrics2.MetricsSource;
 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.MutableStat;
 
 /**
  *
@@ -31,15 +32,25 @@ public class Metrics2TabletServerScanMetrics implements Metrics, MetricsSource
{
 
   private final MetricsSystem system;
   private final MetricsRegistry registry;
+  private final MutableStat scans, resultsPerScan;
 
   Metrics2TabletServerScanMetrics(MetricsSystem system) {
     this.system = system;
     this.registry = new MetricsRegistry(Interns.info("ScanMetrics", "TabletServer Scan Metrics"));
+
+    scans = registry.newStat(TabletServerScanMetricsMBean.scan, "Scans", "Ops", "Count",
true);
+    resultsPerScan = registry.newStat(TabletServerScanMetricsMBean.resultSize, "Results per
scan", "Ops", "Count", true);
   }
 
   @Override
-  public void add(String name, long time) {
-    registry.add(name, time);
+  public void add(String name, long value) {
+    if (TabletServerScanMetricsMBean.scan.equals(name)) {
+      scans.add(value);
+    } else if (TabletServerScanMetricsMBean.resultSize.equals(name)) {
+      resultsPerScan.add(value);
+    } else {
+      throw new RuntimeException("Could not find metric to update for name " + name);
+    }
   }
 
   @Override


Mime
View raw message