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 06:59:49 UTC

svn commit: r753602 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Author: stack
Date: Sat Mar 14 05:59:48 2009
New Revision: 753602

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

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

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=753602&r1=753601&r2=753602&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Sat Mar 14 05:59:48 2009
@@ -95,6 +95,8 @@
    HBASE-803   Atomic increment operations (Ryan Rawson and Jon Gray via Stack)
    HBASE-1252  Make atomic increment perform a binary increment
                (Jonathan Gray via Stack)
+   HBASE-1258,1259 ganglia metrics for 'requests' is confusing
+               (Ryan Rawson via Stack)
 
 Release 0.19.0 - 01/21/2009
   INCOMPATIBLE CHANGES

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=753602&r1=753601&r2=753602&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Sat Mar 14 05:59:48 2009
@@ -22,6 +22,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;
@@ -29,6 +30,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;
 
 
 /** 
@@ -47,34 +49,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");
@@ -102,11 +104,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();
@@ -119,17 +117,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
@@ -140,7 +136,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",