Author: stack
Date: Thu Sep 10 05:05:28 2009
New Revision: 813230
URL: http://svn.apache.org/viewvc?rev=813230&view=rev
Log:
HBASE-1722 Add support for exporting HBase metrics via JMX
Added:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
Added:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java?rev=813230&view=auto
==============================================================================
---
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java
(added)
+++
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java
Thu Sep 10 05:05:28 2009
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.ipc;
+
+import javax.management.ObjectName;
+
+import org.apache.hadoop.metrics.util.MBeanUtil;
+import org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase;
+import org.apache.hadoop.metrics.util.MetricsRegistry;
+
+/**
+ * Exports HBase RPC statistics recorded in {...@link HBaseRpcMetrics} as an
MBean
+ * for JMX monitoring.
+ */
+public class HBaseRPCStatistics extends MetricsDynamicMBeanBase {
+ private final ObjectName mbeanName;
+
+ public HBaseRPCStatistics(MetricsRegistry registry,
+ String hostName, String port) {
+ super(registry, "HBaseRPCStatistics");
+
+ String name = String.format("RPCStatistics-%s",
+ (port != null ? port : "unknown"));
+
+ mbeanName = MBeanUtil.registerMBean("HBase", name, this);
+ }
+
+ public void shutdown() {
+ if (mbeanName != null)
+ MBeanUtil.unregisterMBean(mbeanName);
+ }
+
+}
Added:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java?rev=813230&view=auto
==============================================================================
---
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java
(added)
+++
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java
Thu Sep 10 05:05:28 2009
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.master.metrics;
+
+import javax.management.ObjectName;
+
+import org.apache.hadoop.metrics.util.MBeanUtil;
+import org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase;
+import org.apache.hadoop.metrics.util.MetricsRegistry;
+
+/**
+ * Exports the {...@link MasterMetrics} statistics as an MBean
+ * for JMX.
+ */
+public class MasterStatistics extends MetricsDynamicMBeanBase {
+ private final ObjectName mbeanName;
+
+ public MasterStatistics(MetricsRegistry registry) {
+ super(registry, "MasterStatistics");
+ mbeanName = MBeanUtil.registerMBean("Master", "MasterStatistics", this);
+ }
+
+ public void shutdown() {
+ if (mbeanName != null)
+ MBeanUtil.unregisterMBean(mbeanName);
+ }
+}
Added:
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
URL:
http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java?rev=813230&view=auto
==============================================================================
---
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
(added)
+++
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
Thu Sep 10 05:05:28 2009
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver.metrics;
+
+import javax.management.ObjectName;
+
+import org.apache.hadoop.metrics.util.MBeanUtil;
+import org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase;
+import org.apache.hadoop.metrics.util.MetricsRegistry;
+
+/**
+ * Exports metrics recorded by {...@link RegionServerMetrics} as an MBean
+ * for JMX monitoring.
+ */
+public class RegionServerStatistics extends MetricsDynamicMBeanBase {
+
+ private final ObjectName mbeanName;
+
+ public RegionServerStatistics(MetricsRegistry registry, String rsName) {
+ super(registry, "RegionServerStatistics");
+ mbeanName = MBeanUtil.registerMBean("RegionServer",
+ "RegionServerStatistics", this);
+ }
+
+ public void shutdown() {
+ if (mbeanName != null)
+ MBeanUtil.unregisterMBean(mbeanName);
+ }
+
+}
\ No newline at end of file