You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dh...@apache.org on 2016/06/09 02:23:36 UTC
[3/3] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7
Conflicts:
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7f124337
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7f124337
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7f124337
Branch: refs/heads/1.7
Commit: 7f12433735f9535b3f06dc2744d596192f414406
Parents: e743695 67605d7
Author: Dylan Hutchison <dh...@cs.washington.edu>
Authored: Wed Jun 8 19:21:28 2016 -0700
Committer: Dylan Hutchison <dh...@cs.washington.edu>
Committed: Wed Jun 8 19:21:28 2016 -0700
----------------------------------------------------------------------
.../org/apache/accumulo/tserver/metrics/TabletServerMBean.java | 2 +-
.../apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java | 2 +-
.../accumulo/tserver/metrics/TabletServerMetricsUtil.java | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f124337/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
index 42b2a9c,0000000..465e50a
mode 100644,000000..100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBeanImpl.java
@@@ -1,175 -1,0 +1,175 @@@
+/*
+ * 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.accumulo.tserver.metrics;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+
+import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
+import org.apache.accumulo.tserver.TabletServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TabletServerMBeanImpl extends AbstractMetricsImpl implements TabletServerMBean {
+ private static final Logger log = LoggerFactory.getLogger(TabletServerMBeanImpl.class);
+ private static final String METRICS_PREFIX = "tserver";
+ private ObjectName OBJECT_NAME = null;
+
+ private final TabletServerMetricsUtil util;
+
+ TabletServerMBeanImpl(TabletServer server) {
+ util = new TabletServerMetricsUtil(server);
+ try {
+ OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerMBean,instance=" + Thread.currentThread().getName());
+ } catch (MalformedObjectNameException e) {
+ log.error("Exception setting MBean object name", e);
+ }
+ }
+
+ @Override
+ public void register() throws Exception {
+ // Do this because interface not in same package.
+ StandardMBean mbean = new StandardMBean(this, TabletServerMBean.class, false);
+ register(mbean);
+ }
+
+ @Override
+ public long getEntries() {
+ if (isEnabled()) {
+ return util.getEntries();
+ }
+ return 0;
+ }
+
+ @Override
+ public long getEntriesInMemory() {
+ if (isEnabled()) {
+ return util.getEntriesInMemory();
+ }
+ return 0;
+ }
+
+ @Override
- public long getIngest() {
++ public double getIngest() {
+ if (isEnabled()) {
+ return util.getIngest();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMajorCompactions() {
+ if (isEnabled()) {
+ return util.getMajorCompactions();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMajorCompactionsQueued() {
+ if (isEnabled()) {
+ return util.getMajorCompactionsQueued();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMinorCompactions() {
+ if (isEnabled()) {
+ return util.getMinorCompactions();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getMinorCompactionsQueued() {
+ if (isEnabled()) {
+ return util.getMinorCompactionsQueued();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getOnlineCount() {
+ if (isEnabled())
+ return util.getOnlineCount();
+ return 0;
+ }
+
+ @Override
+ public int getOpeningCount() {
+ if (isEnabled())
+ return util.getOpeningCount();
+ return 0;
+ }
+
+ @Override
+ public long getQueries() {
+ if (isEnabled()) {
+ return util.getQueries();
+ }
+ return 0;
+ }
+
+ @Override
+ public int getUnopenedCount() {
+ if (isEnabled())
+ return util.getUnopenedCount();
+ return 0;
+ }
+
+ @Override
+ public String getName() {
+ if (isEnabled())
+ return util.getName();
+ return "";
+ }
+
+ @Override
+ public long getTotalMinorCompactions() {
+ if (isEnabled())
+ return util.getTotalMinorCompactions();
+ return 0;
+ }
+
+ @Override
+ public double getHoldTime() {
+ if (isEnabled())
+ return util.getHoldTime();
+ return 0;
+ }
+
+ @Override
+ public double getAverageFilesPerTablet() {
+ if (isEnabled()) {
+ return util.getAverageFilesPerTablet();
+ }
+ return 0;
+ }
+
+ @Override
+ protected ObjectName getObjectName() {
+ return OBJECT_NAME;
+ }
+
+ @Override
+ protected String getMetricsPrefix() {
+ return METRICS_PREFIX;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7f124337/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsUtil.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsUtil.java
index 5905aea,0000000..339ebf2
mode 100644,000000..100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsUtil.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMetricsUtil.java
@@@ -1,138 -1,0 +1,138 @@@
+/*
+ * 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.accumulo.tserver.metrics;
+
+import org.apache.accumulo.tserver.TabletServer;
+import org.apache.accumulo.tserver.tablet.Tablet;
+
+/**
+ * Wrapper around extracting metrics from a TabletServer instance
+ *
+ * Necessary to support both old custom JMX metrics and Hadoop Metrics2
+ */
+public class TabletServerMetricsUtil {
+
+ private final TabletServer tserver;
+
+ public TabletServerMetricsUtil(TabletServer tserver) {
+ this.tserver = tserver;
+ }
+
+ public long getEntries() {
+ long result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ result += tablet.getNumEntries();
+ }
+ return result;
+ }
+
+ public long getEntriesInMemory() {
+ long result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ result += tablet.getNumEntriesInMemory();
+ }
+ return result;
+ }
+
- public long getIngest() {
- long result = 0;
++ public double getIngest() {
++ double result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
- result += tablet.getNumEntriesInMemory();
++ result += tablet.ingestRate();
+ }
+ return result;
+ }
+
+ public int getMajorCompactions() {
+ int result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ if (tablet.isMajorCompactionRunning())
+ result++;
+ }
+ return result;
+ }
+
+ public int getMajorCompactionsQueued() {
+ int result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ if (tablet.isMajorCompactionQueued())
+ result++;
+ }
+ return result;
+ }
+
+ public int getMinorCompactions() {
+ int result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ if (tablet.isMinorCompactionRunning())
+ result++;
+ }
+ return result;
+ }
+
+ public int getMinorCompactionsQueued() {
+ int result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ if (tablet.isMinorCompactionQueued())
+ result++;
+ }
+ return result;
+ }
+
+ public int getOnlineCount() {
+ return tserver.getOnlineTablets().size();
+ }
+
+ public int getOpeningCount() {
+ return tserver.getOpeningCount();
+ }
+
+ public long getQueries() {
+ long result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ result += tablet.totalQueries();
+ }
+ return result;
+ }
+
+ public int getUnopenedCount() {
+ return tserver.getUnopenedCount();
+ }
+
+ public String getName() {
+ return tserver.getClientAddressString();
+ }
+
+ public long getTotalMinorCompactions() {
+ return tserver.getTotalMinorCompactions();
+ }
+
+ public double getHoldTime() {
+ return tserver.getHoldTimeMillis() / 1000.;
+ }
+
+ public double getAverageFilesPerTablet() {
+ int count = 0;
+ long result = 0;
+ for (Tablet tablet : tserver.getOnlineTablets()) {
+ result += tablet.getDatafiles().size();
+ count++;
+ }
+ if (count == 0)
+ return 0;
+ return result / (double) count;
+ }
+}