You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nd...@apache.org on 2015/08/11 02:13:17 UTC
hbase git commit: Revert "HBASE-12911 Client-side metrics"
Repository: hbase
Updated Branches:
refs/heads/master 06989fd1f -> e4106b4c4
Revert "HBASE-12911 Client-side metrics"
This reverts commit 06989fd1f936f905a94e6e98e462ba72704d05c4.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e4106b4c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e4106b4c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e4106b4c
Branch: refs/heads/master
Commit: e4106b4c4a3b762e5c9c2b35adf3e048a3ab3b2d
Parents: 06989fd
Author: Nick Dimiduk <nd...@apache.org>
Authored: Mon Aug 10 17:13:09 2015 -0700
Committer: Nick Dimiduk <nd...@apache.org>
Committed: Mon Aug 10 17:13:09 2015 -0700
----------------------------------------------------------------------
hbase-client/pom.xml | 4 -
.../apache/hadoop/hbase/client/Connection.java | 7 --
.../hadoop/hbase/client/ConnectionAdapter.java | 5 -
.../hbase/client/ConnectionImplementation.java | 14 +--
.../apache/hadoop/hbase/client/MetaCache.java | 9 --
.../hadoop/hbase/client/MetricsConnection.java | 48 ----------
.../client/MetricsConnectionWrapperImpl.java | 99 --------------------
.../hbase/client/MetricsConnectionSource.java | 87 -----------------
.../client/MetricsConnectionSourceFactory.java | 32 -------
.../hbase/client/MetricsConnectionWrapper.java | 50 ----------
.../MetricsConnectionSourceFactoryImpl.java | 28 ------
.../client/MetricsConnectionSourceImpl.java | 86 -----------------
....hbase.client.MetricsConnectionSourceFactory | 18 ----
13 files changed, 3 insertions(+), 484 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-client/pom.xml b/hbase-client/pom.xml
index 11eea17..dc0da77 100644
--- a/hbase-client/pom.xml
+++ b/hbase-client/pom.xml
@@ -128,10 +128,6 @@
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
- <artifactId>hbase-hadoop-compat</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<type>test-jar</type>
</dependency>
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
index cfc9d56..dab4905 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Connection.java
@@ -175,11 +175,4 @@ public interface Connection extends Abortable, Closeable {
*/
boolean isClosed();
- /**
- * Retrieve the metrics instance for this connection.
- *
- * @return a MetricsConnection instance for examining connection metrics.
- */
- public MetricsConnection getConnectionMetrics();
-
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionAdapter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionAdapter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionAdapter.java
index aace6ef..1d8a793 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionAdapter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionAdapter.java
@@ -131,11 +131,6 @@ abstract class ConnectionAdapter implements ClusterConnection {
}
@Override
- public MetricsConnection getConnectionMetrics() {
- return wrappedConnection.getConnectionMetrics();
- }
-
- @Override
public boolean isMasterRunning() throws MasterNotRunningException,
ZooKeeperConnectionException {
return wrappedConnection.isMasterRunning();
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
index beb2f66..2754997 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
@@ -118,7 +118,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
private final AsyncProcess asyncProcess;
// single tracker per connection
private final ServerStatisticTracker stats;
- private final MetricsConnection metrics;
private volatile boolean closed;
private volatile boolean aborted;
@@ -155,11 +154,11 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
// Client rpc instance.
private RpcClient rpcClient;
- private final MetaCache metaCache;
+ private MetaCache metaCache = new MetaCache();
private int refCount;
- protected User user;
+ private User user;
private RpcRetryingCallerFactory rpcCallerFactory;
@@ -237,13 +236,11 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
} else {
nonceGenerator = new NoNonceGenerator();
}
- this.stats = ServerStatisticTracker.create(conf);
+ stats = ServerStatisticTracker.create(conf);
this.asyncProcess = createAsyncProcess(this.conf);
this.interceptor = (new RetryingCallerInterceptorFactory(conf)).build();
this.rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf, interceptor, this.stats);
this.backoffPolicy = ClientBackoffPolicyFactory.create(conf);
- this.metrics = new MetricsConnection(new MetricsConnectionWrapperImpl(this));
- this.metaCache = new MetaCache(this.metrics);
}
/**
@@ -365,11 +362,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable {
return new HBaseAdmin(this);
}
- @Override
- public MetricsConnection getConnectionMetrics() {
- return this.metrics;
- }
-
private ExecutorService getBatchPool() {
if (batchPool == null) {
synchronized (this) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java
index e763dd9..8e1c93c 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java
@@ -59,12 +59,6 @@ public class MetaCache {
// The access to this attribute must be protected by a lock on cachedRegionLocations
private final Set<ServerName> cachedServers = new ConcurrentSkipListSet<ServerName>();
- private final MetricsConnection metrics;
-
- public MetaCache(MetricsConnection metrics) {
- this.metrics = metrics;
- }
-
/**
* Search the cache for a location that fits our table and row key.
* Return null if no suitable region is located.
@@ -80,7 +74,6 @@ public class MetaCache {
Entry<byte[], RegionLocations> e = tableLocations.floorEntry(row);
if (e == null) {
- metrics.incrMetaCacheMiss();
return null;
}
RegionLocations possibleRegion = e.getValue();
@@ -101,12 +94,10 @@ public class MetaCache {
// HConstants.EMPTY_END_ROW) check itself will pass.
if (Bytes.equals(endKey, HConstants.EMPTY_END_ROW) ||
Bytes.compareTo(endKey, 0, endKey.length, row, 0, row.length) > 0) {
- metrics.incrMetaCacheHit();
return possibleRegion;
}
// Passed all the way through, so we got nothing - complete cache miss
- metrics.incrMetaCacheMiss();
return null;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
deleted file mode 100644
index 2c34c9c..0000000
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.client;
-
-import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.classification.InterfaceStability;
-
-/**
- * This class is for maintaining the various connection statistics and publishing them through
- * the metrics interfaces.
- */
-@InterfaceStability.Evolving
-@InterfaceAudience.Private
-public class MetricsConnection {
-
- private final MetricsConnectionWrapper wrapper;
- private final MetricsConnectionSource source;
-
- public MetricsConnection(MetricsConnectionWrapper wrapper) {
- this.wrapper = wrapper;
- this.source = CompatibilitySingletonFactory.getInstance(MetricsConnectionSourceFactory.class)
- .createConnection(this.wrapper);
- }
-
- public void incrMetaCacheHit() {
- source.incrMetaCacheHit();
- }
-
- public void incrMetaCacheMiss() {
- source.incrMetaCacheMiss();
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapperImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapperImpl.java
deleted file mode 100644
index e6056ec..0000000
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapperImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * 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.client;
-
-import com.google.common.base.Preconditions;
-
-import java.util.concurrent.ThreadPoolExecutor;
-
-public class MetricsConnectionWrapperImpl implements MetricsConnectionWrapper {
-
- private final ConnectionImplementation conn;
-
- public MetricsConnectionWrapperImpl(ConnectionImplementation connection) {
- Preconditions.checkNotNull(connection);
- this.conn = connection;
- }
-
- @Override public String getId() {
- return conn.toString();
- }
-
- @Override public String getUserName() {
- return conn.user == null ? "" : conn.user.toString();
- }
-
- @Override public String getClusterId() {
- return conn.clusterId;
- }
-
- @Override public String getZookeeperQuorum() {
- try {
- return conn.getKeepAliveZooKeeperWatcher().getQuorum();
- } catch (Exception e) {
- return "";
- }
- }
-
- @Override public String getZookeeperBaseNode() {
- try {
- return conn.getKeepAliveZooKeeperWatcher().getBaseZNode();
- } catch (Exception e) {
- return "";
- }
- }
-
- @Override public int getMetaLookupPoolActiveCount() {
- if (conn.getCurrentMetaLookupPool() == null) {
- return 0;
- }
- ThreadPoolExecutor tpe = (ThreadPoolExecutor) conn.getCurrentMetaLookupPool();
- return tpe.getActiveCount();
- }
-
- @Override public int getMetaLookupPoolLargestPoolSize() {
- if (conn.getCurrentMetaLookupPool() == null) {
- return 0;
- }
- ThreadPoolExecutor tpe = (ThreadPoolExecutor) conn.getCurrentMetaLookupPool();
- return tpe.getLargestPoolSize();
- }
-
- @Override public String getBatchPoolId() {
- if (conn.getCurrentBatchPool() == null) {
- return "";
- }
- return Integer.toHexString(conn.getCurrentBatchPool().hashCode());
- }
-
- @Override public int getBatchPoolActiveCount() {
- if (conn.getCurrentBatchPool() == null) {
- return 0;
- }
- ThreadPoolExecutor tpe = (ThreadPoolExecutor) conn.getCurrentBatchPool();
- return tpe.getActiveCount();
- }
-
- @Override public int getBatchPoolLargestPoolSize() {
- if (conn.getCurrentBatchPool() == null) {
- return 0;
- }
- ThreadPoolExecutor tpe = (ThreadPoolExecutor) conn.getCurrentBatchPool();
- return tpe.getLargestPoolSize();
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSource.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSource.java
deleted file mode 100644
index 53f9f11..0000000
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSource.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.client;
-
-import org.apache.hadoop.hbase.metrics.BaseSource;
-
-public interface MetricsConnectionSource extends BaseSource {
-
- /**
- * The name of the metrics
- */
- String METRICS_NAME = "Connection";
-
- /**
- * The name of the metrics context that metrics will be under.
- */
- String METRICS_CONTEXT = "connection";
-
- /**
- * Description
- */
- String METRICS_DESCRIPTION = "Metrics about HBase Connection";
-
- /**
- * The name of the metrics context that metrics will be under in jmx
- */
- String METRICS_JMX_CONTEXT = "Client,sub=";
-
- /**
- * Increment number of meta cache hits
- */
- void incrMetaCacheHit();
-
- /**
- * Increment number of meta cache misses
- */
- void incrMetaCacheMiss();
-
- // Strings used for exporting to metrics system.
- String CONNECTION_ID_NAME = "connectionId";
- String CONNECTION_ID_DESC = "The connection's process-unique identifier.";
- String USER_NAME_NAME = "userName";
- String USER_NAME_DESC = "The user on behalf of whom the Connection is acting.";
- String CLUSTER_ID_NAME = "clusterId";
- String CLUSTER_ID_DESC = "Cluster Id";
- String ZOOKEEPER_QUORUM_NAME = "zookeeperQuorum";
- String ZOOKEEPER_QUORUM_DESC = "Zookeeper Quorum";
- String ZOOKEEPER_ZNODE_NAME = "zookeeperBaseZNode";
- String ZOOKEEPER_ZNODE_DESC = "Base ZNode for this cluster.";
-
- String META_CACHE_HIT_NAME = "metaCacheHit";
- String META_CACHE_HIT_DESC =
- "A counter on the number of times this connection's meta cache has a valid region location.";
- String META_CACHE_MISS_NAME = "metaCacheMiss";
- String META_CACHE_MISS_DESC =
- "A counter on the number of times this connection does not know where to find a region.";
-
- String META_LOOKUP_POOL_ACTIVE_THREAD_NAME = "metaLookupPoolActiveThreads";
- String META_LOOKUP_POOL_ACTIVE_THREAD_DESC =
- "The approximate number of threads actively resolving region locations from META.";
- String META_LOOKUP_POOL_LARGEST_SIZE_NAME = "metaLookupPoolLargestSize";
- String META_LOOKUP_POOL_LARGEST_SIZE_DESC =
- "The largest number of threads that have ever simultaneously been in the pool.";
- String BATCH_POOL_ID_NAME = "batchPoolId";
- String BATCH_POOL_ID_DESC = "The connection's batch pool's unique identifier.";
- String BATCH_POOL_ACTIVE_THREAD_NAME = "batchPoolActiveThreads";
- String BATCH_POOL_ACTIVE_THREAD_DESC =
- "The approximate number of threads executing table operations.";
- String BATCH_POOL_LARGEST_SIZE_NAME = "batchPoolLargestSize";
- String BATCH_POOL_LARGEST_SIZE_DESC =
- "The largest number of threads that have ever simultaneously been in the pool.";
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactory.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactory.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactory.java
deleted file mode 100644
index 9b30421..0000000
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.client;
-
-/**
- * Interface of a factory to create Metrics Sources used inside of Connections.
- */
-public interface MetricsConnectionSourceFactory {
-
- /**
- * Given a wrapper create a {@link MetricsConnectionSource}.
- *
- * @param wrapper The wrapped Connection
- * @return a Metrics Source.
- */
- public MetricsConnectionSource createConnection(MetricsConnectionWrapper wrapper);
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapper.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapper.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapper.java
deleted file mode 100644
index 43410a8..0000000
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionWrapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.client;
-
-/**
- * This is the interface that will expose Connection information to hadoop1/hadoop2
- * implementations of the {@link MetricsConnectionSource}.
- */
-public interface MetricsConnectionWrapper {
-
- /** Get the connection's unique identifier */
- String getId();
-
- /** Get the User's name. */
- String getUserName();
-
- /** Get the Cluster ID */
- String getClusterId();
-
- /** Get the Zookeeper Quorum Info */
- String getZookeeperQuorum();
-
- /** Get the base ZNode for this cluster. */
- String getZookeeperBaseNode();
-
- int getMetaLookupPoolActiveCount();
-
- int getMetaLookupPoolLargestPoolSize();
-
- String getBatchPoolId();
-
- int getBatchPoolActiveCount();
-
- int getBatchPoolLargestPoolSize();
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactoryImpl.java
deleted file mode 100644
index faa3295..0000000
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceFactoryImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.client;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-
-@InterfaceAudience.Private
-public class MetricsConnectionSourceFactoryImpl implements MetricsConnectionSourceFactory {
-
- @Override public MetricsConnectionSource createConnection(MetricsConnectionWrapper wrapper) {
- return new MetricsConnectionSourceImpl(wrapper);
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceImpl.java
deleted file mode 100644
index 06da639..0000000
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/client/MetricsConnectionSourceImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.client;
-
-import org.apache.hadoop.hbase.metrics.BaseSourceImpl;
-import org.apache.hadoop.metrics2.MetricsCollector;
-import org.apache.hadoop.metrics2.MetricsRecordBuilder;
-import org.apache.hadoop.metrics2.lib.Interns;
-import org.apache.hadoop.metrics2.lib.MutableCounterLong;
-
-public class MetricsConnectionSourceImpl
- extends BaseSourceImpl implements MetricsConnectionSource {
-
- // wrapper for access statistics collected in Connection instance
- private final MetricsConnectionWrapper wrapper;
-
- // Hadoop Metric2 objects for additional monitoring
-
- private final MutableCounterLong metaCacheHit;
- private final MutableCounterLong metaCacheMiss;
-
- public MetricsConnectionSourceImpl(MetricsConnectionWrapper wrapper) {
- this(METRICS_NAME, METRICS_DESCRIPTION, METRICS_CONTEXT,
- METRICS_JMX_CONTEXT + wrapper.getId(), wrapper);
- }
-
- public MetricsConnectionSourceImpl(String metricsName, String metricsDescription,
- String metricsContext, String metricsJmxContext, MetricsConnectionWrapper wrapper) {
- super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
- this.wrapper = wrapper;
-
- metaCacheHit = getMetricsRegistry().newCounter(META_CACHE_HIT_NAME, META_CACHE_HIT_DESC, 0l);
- metaCacheMiss =
- getMetricsRegistry().newCounter(META_CACHE_MISS_NAME, META_CACHE_MISS_DESC, 0l);
- }
-
- @Override
- public void getMetrics(MetricsCollector metricsCollector, boolean all) {
-
- MetricsRecordBuilder mrb = metricsCollector.addRecord(metricsName);
-
- if (wrapper != null) {
- mrb.addGauge(Interns.info(META_LOOKUP_POOL_LARGEST_SIZE_NAME,
- META_LOOKUP_POOL_LARGEST_SIZE_DESC), wrapper.getMetaLookupPoolLargestPoolSize())
- .addGauge(Interns.info(META_LOOKUP_POOL_ACTIVE_THREAD_NAME,
- META_LOOKUP_POOL_ACTIVE_THREAD_DESC), wrapper.getMetaLookupPoolActiveCount())
- .tag(Interns.info(BATCH_POOL_ID_NAME, BATCH_POOL_ID_DESC), wrapper.getBatchPoolId())
- .addGauge(Interns.info(BATCH_POOL_ACTIVE_THREAD_NAME, BATCH_POOL_ACTIVE_THREAD_DESC),
- wrapper.getBatchPoolActiveCount())
- .addGauge(Interns.info(BATCH_POOL_LARGEST_SIZE_NAME, BATCH_POOL_LARGEST_SIZE_DESC),
- wrapper.getBatchPoolLargestPoolSize())
- .tag(Interns.info(CONNECTION_ID_NAME, CONNECTION_ID_DESC), wrapper.getId())
- .tag(Interns.info(USER_NAME_NAME, USER_NAME_DESC), wrapper.getUserName())
- .tag(Interns.info(CLUSTER_ID_NAME, CLUSTER_ID_DESC), wrapper.getClusterId())
- .tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC),
- wrapper.getZookeeperQuorum())
- .tag(Interns.info(ZOOKEEPER_ZNODE_NAME, ZOOKEEPER_ZNODE_DESC),
- wrapper.getZookeeperBaseNode());
- }
-
- metricsRegistry.snapshot(mrb, all);
- }
-
- @Override public void incrMetaCacheHit() {
- metaCacheHit.incr();
- }
-
- @Override public void incrMetaCacheMiss() {
- metaCacheMiss.incr();
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e4106b4c/hbase-hadoop2-compat/src/main/resources/META-INF/services/org.apache.hadoop.hbase.client.MetricsConnectionSourceFactory
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/resources/META-INF/services/org.apache.hadoop.hbase.client.MetricsConnectionSourceFactory b/hbase-hadoop2-compat/src/main/resources/META-INF/services/org.apache.hadoop.hbase.client.MetricsConnectionSourceFactory
deleted file mode 100644
index 4adf4c8..0000000
--- a/hbase-hadoop2-compat/src/main/resources/META-INF/services/org.apache.hadoop.hbase.client.MetricsConnectionSourceFactory
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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.
-#
-org.apache.hadoop.hbase.client.MetricsConnectionSourceFactoryImpl