hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1040279 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase: master/metrics/MasterMetrics.java metrics/MetricsMBeanBase.java regionserver/metrics/RegionServerMetrics.java
Date Mon, 29 Nov 2010 20:45:44 GMT
Author: stack
Date: Mon Nov 29 20:45:43 2010
New Revision: 1040279

URL: http://svn.apache.org/viewvc?rev=1040279&view=rev
Log:
HBASE-3223 Get VersionInfo for Running HBase Process

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/metrics/MetricsMBeanBase.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java?rev=1040279&r1=1040278&r2=1040279&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java Mon
Nov 29 20:45:43 2010
@@ -21,6 +21,7 @@ import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.metrics.HBaseInfo;
 import org.apache.hadoop.hbase.metrics.MetricsRate;
 import org.apache.hadoop.hbase.metrics.PersistentMetricsTimeVaryingRate;
 import org.apache.hadoop.metrics.ContextFactory;
@@ -69,6 +70,7 @@ public class MasterMetrics implements Up
     metricsRecord.setTag("Master", name);
     context.registerUpdater(this);
     JvmMetrics.init("Master", name);
+    HBaseInfo.init();
 
     // expose the MBean for metrics
     masterStatistics = new MasterStatistics(this.registry);

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/metrics/MetricsMBeanBase.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/metrics/MetricsMBeanBase.java?rev=1040279&r1=1040278&r2=1040279&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/metrics/MetricsMBeanBase.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/metrics/MetricsMBeanBase.java Mon Nov
29 20:45:43 2010
@@ -95,14 +95,20 @@ public class MetricsMBeanBase extends Me
         continue;
 
       // add on custom HBase metric types
-      if (metric instanceof org.apache.hadoop.hbase.metrics.MetricsRate) {
+      if (metric instanceof MetricsRate) {
         attributes.add( new MBeanAttributeInfo(metric.getName(),
             "java.lang.Float", metric.getDescription(), true, false, false) );
         extendedAttributes.put(metric.getName(), metric);
+      } else if (metric instanceof MetricsString) {
+        attributes.add( new MBeanAttributeInfo(metric.getName(),
+            "java.lang.String", metric.getDescription(), true, false, false) );
+        extendedAttributes.put(metric.getName(), metric);
+        LOG.info("MetricsString added: " + metric.getName());
       }
       // else, its probably a hadoop metric already registered. Skip it.
     }
 
+    LOG.info("new MBeanInfo");
     this.extendedInfo = new MBeanInfo( this.getClass().getName(),
         this.description, attributes.toArray( new MBeanAttributeInfo[0] ),
         parentInfo.getConstructors(), parentInfo.getOperations(),
@@ -140,6 +146,8 @@ public class MetricsMBeanBase extends Me
       if (metric != null) {
         if (metric instanceof MetricsRate) {
           return ((MetricsRate) metric).getPreviousIntervalValue();
+        } else if (metric instanceof MetricsString) {
+          return ((MetricsString)metric).getValue();
         } else {
           LOG.warn( String.format("unknown metrics type %s for attribute %s",
                         metric.getClass().getName(), name) );

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1040279&r1=1040278&r2=1040279&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Mon Nov 29 20:45:43 2010
@@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.regionse
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.hfile.HFile;
+import org.apache.hadoop.hbase.metrics.HBaseInfo;
 import org.apache.hadoop.hbase.metrics.MetricsRate;
 import org.apache.hadoop.hbase.metrics.PersistentMetricsTimeVaryingRate;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
@@ -173,6 +174,8 @@ public class RegionServerMetrics impleme
     context.registerUpdater(this);
     // Add jvmmetrics.
     JvmMetrics.init("RegionServer", name);
+    // Add Hbase Info metrics
+    HBaseInfo.init();
 
     // export for JMX
     statistics = new RegionServerStatistics(this.registry, name);



Mime
View raw message