HBASE-1722 Add support for exporting HBase metrics via JMX
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@813230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
062042ba83
commit
07e4c7264a
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue