You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2009/03/14 07:05:10 UTC

svn commit: r753604 - in /hadoop/hbase/branches/0.19: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Author: stack
Date: Sat Mar 14 06:05:10 2009
New Revision: 753604

URL: http://svn.apache.org/viewvc?rev=753604&view=rev
Log:
HBASE-1258,1259 ganglia metrics for 'requests' is confusing

Modified:
    hadoop/hbase/branches/0.19/CHANGES.txt
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Modified: hadoop/hbase/branches/0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/CHANGES.txt?rev=753604&r1=753603&r2=753604&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19/CHANGES.txt Sat Mar 14 06:05:10 2009
@@ -51,6 +51,8 @@
    HBASE-1252  Make atomic increment perform a binary increment
                (Jonathan Gray via Stack)
    HBASE-1253  Remove unnecessary, expensive column matcher lookup
+   HBASE-1258,1259 ganglia metrics for 'requests' is confusing
+               (Ryan Rawson via Stack)
 
 Release 0.19.0
   INCOMPATIBLE CHANGES

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=753604&r1=753603&r2=753604&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Sat Mar 14 06:05:10 2009
@@ -23,6 +23,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.metrics.MetricsRate;
 import org.apache.hadoop.hbase.util.Strings;
 import org.apache.hadoop.metrics.MetricsContext;
 import org.apache.hadoop.metrics.MetricsRecord;
@@ -30,6 +31,7 @@
 import org.apache.hadoop.metrics.Updater;
 import org.apache.hadoop.metrics.jvm.JvmMetrics;
 import org.apache.hadoop.metrics.util.MetricsIntValue;
+import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
 
 
 /** 
@@ -48,34 +50,34 @@
   /**
    * Count of regions carried by this regionserver
    */
-  public final MetricsIntValue regions = new MetricsIntValue("regions");
+  public final MetricsIntValue regions = new MetricsIntValue("hbase_regions");
   
   /*
    * Count of requests to the regionservers since last call to metrics update
    */
-  private final MetricsIntValue requests = new MetricsIntValue("requests");
+  private final MetricsRate requests = new MetricsRate("hbase_requests");
 
   /**
    * Count of stores open on the regionserver.
    */
-  public final MetricsIntValue stores = new MetricsIntValue("stores");
+  public final MetricsIntValue stores = new MetricsIntValue("hbase_stores");
 
   /**
    * Count of storefiles open on the regionserver.
    */
-  public final MetricsIntValue storefiles = new MetricsIntValue("storefiles");
+  public final MetricsIntValue storefiles = new MetricsIntValue("hbase_storefiles");
 
   /**
    * Sum of all the storefile index sizes in this regionserver in MB
    */
   public final MetricsIntValue storefileIndexSizeMB =
-    new MetricsIntValue("storefileIndexSizeMB");
+    new MetricsIntValue("hbase_storefileIndexSizeMB");
 
   /**
    * Sum of all the memcache sizes in this regionserver in MB
    */
   public final MetricsIntValue memcacheSizeMB =
-    new MetricsIntValue("memcachSizeMB");
+    new MetricsIntValue("hbase_memcacheSizeMB");
 
   public RegionServerMetrics() {
     MetricsContext context = MetricsUtil.getContext("hbase");
@@ -103,11 +105,7 @@
       this.storefileIndexSizeMB.pushMetric(this.metricsRecord);
       this.memcacheSizeMB.pushMetric(this.metricsRecord);
       this.regions.pushMetric(this.metricsRecord);
-      synchronized(this.requests) {
-        this.requests.pushMetric(this.metricsRecord);
-        // Set requests down to zero again.
-        this.requests.set(0);
-      }
+      this.requests.pushMetric(this.metricsRecord);
     }
     this.metricsRecord.update();
     this.lastUpdate = System.currentTimeMillis();
@@ -120,17 +118,15 @@
   /**
    * @return Count of requests.
    */
-  public int getRequests() {
-    return this.requests.get();
+  public float getRequests() {
+    return this.requests.getPreviousIntervalValue();
   }
   
   /**
    * @param inc How much to add to requests.
    */
   public void incrementRequests(final int inc) {
-    synchronized(this.requests) {
-      this.requests.inc(inc);
-    }
+    this.requests.inc(inc);
   }
   
   @Override
@@ -141,7 +137,7 @@
       seconds = 1;
     }
     sb = Strings.appendKeyValue(sb, "request",
-      Integer.valueOf(this.requests.get()/seconds));
+      Float.valueOf(this.requests.getPreviousIntervalValue()));
     sb = Strings.appendKeyValue(sb, "regions",
       Integer.valueOf(this.regions.get()));
     sb = Strings.appendKeyValue(sb, "stores",