hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sze...@apache.org
Subject hive git commit: HIVE-12868 : Fix empty operation-pool metrics (Szehon, reviewed by Jimmy Xiang)
Date Fri, 15 Jan 2016 19:13:54 GMT
Repository: hive
Updated Branches:
  refs/heads/master ef706b76b -> f3ea7773b


HIVE-12868 : Fix empty operation-pool metrics (Szehon, reviewed by Jimmy Xiang)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f3ea7773
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f3ea7773
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f3ea7773

Branch: refs/heads/master
Commit: f3ea7773beda9267be71a803f56bbb8e1706ac65
Parents: ef706b7
Author: Szehon Ho <szehon@cloudera.com>
Authored: Fri Jan 15 11:12:48 2016 -0800
Committer: Szehon Ho <szehon@cloudera.com>
Committed: Fri Jan 15 11:13:30 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java    |  6 +++---
 .../org/apache/hive/service/server/HiveServer2.java     | 12 +++++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/f3ea7773/itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java
b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java
index c55c05e..0b88936 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/miniHS2/TestHs2Metrics.java
@@ -75,12 +75,12 @@ public class TestHs2Metrics {
     confOverlay = new HashMap<String, String>();
     confOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
     confOverlay.put(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, MetricCheckingHook.class.getName());
+    confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_METRICS_ENABLED.varname, "true");
+    confOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
     miniHS2.start(confOverlay);
 
     HiveConf conf = new HiveConf();
-    conf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_METRICS_ENABLED, true);
-    conf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
-    MetricsFactory.init(conf);
+
 
     metrics = (CodahaleMetrics) MetricsFactory.getInstance();
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/f3ea7773/service/src/java/org/apache/hive/service/server/HiveServer2.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 2f55591..9c76683 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -99,6 +99,15 @@ public class HiveServer2 extends CompositeService {
 
   @Override
   public synchronized void init(HiveConf hiveConf) {
+    //Initialize metrics first, as some metrics are for initialization stuff.
+    try {
+      if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_METRICS_ENABLED)) {
+        MetricsFactory.init(hiveConf);
+      }
+    } catch (Throwable t) {
+      LOG.warn("Could not initiate the HiveServer2 Metrics system.  Metrics may not be reported.",
t);
+    }
+
     cliService = new CLIService(this);
     addService(cliService);
     final HiveServer2 hiveServer2 = this;
@@ -506,9 +515,6 @@ public class HiveServer2 extends CompositeService {
         server.init(hiveConf);
         server.start();
 
-        if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_METRICS_ENABLED)) {
-          MetricsFactory.init(hiveConf);
-        }
         try {
           JvmPauseMonitor pauseMonitor = new JvmPauseMonitor(hiveConf);
           pauseMonitor.start();


Mime
View raw message