accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject accumulo git commit: Use MutableCounter and (extended) MutableStats for update metric elements
Date Thu, 04 Dec 2014 18:02:30 GMT
Repository: accumulo
Updated Branches:
  refs/heads/metrics2-backwardscompat a056b1ca0 -> f3f8dc467


Use MutableCounter and (extended) MutableStats for update metric elements


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

Branch: refs/heads/metrics2-backwardscompat
Commit: f3f8dc467e6d6cdf82c6bbfe4a2269191dcca351
Parents: a056b1c
Author: Josh Elser <elserj@apache.org>
Authored: Thu Dec 4 13:01:50 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Dec 4 13:02:14 2014 -0500

----------------------------------------------------------------------
 .../Metrics2TabletServerUpdateMetrics.java      | 34 ++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f3f8dc46/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 a8e0ad4..f883b60 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
@@ -23,6 +23,8 @@ 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.MutableCounterLong;
+import org.apache.hadoop.metrics2.lib.MutableStat;
 
 /**
  *
@@ -32,14 +34,42 @@ public class Metrics2TabletServerUpdateMetrics implements Metrics, MetricsSource
   private final MetricsSystem system;
   private final MetricsRegistry registry;
 
+  private final MutableCounterLong permissionErrors, unknownTabletErrors, constraintViolations;
+  private final MutableStat commitPrep, walogWriteTime, commitTime, mutationArraySize;
+
   public Metrics2TabletServerUpdateMetrics(MetricsSystem system) {
     this.system = system;
     this.registry = new MetricsRegistry(Interns.info("UpdateMetrics", "TabletServer Update
Metrics"));
+
+    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);
+
+    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);
   }
 
   @Override
-  public void add(String name, long time) {
-    registry.add(name, time);
+  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);
+    } else {
+      throw new RuntimeException("Cannot process metric with name " + name);
+    }
   }
 
   @Override


Mime
View raw message