hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x...@apache.org
Subject hadoop git commit: HDFS-12247. Ozone: KeySpaceManager should unregister KSMMetrics upon stop. Contributed by Yiqun Lin.
Date Thu, 03 Aug 2017 19:48:14 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 92945d01b -> 507447c81


HDFS-12247. Ozone: KeySpaceManager should unregister KSMMetrics upon stop. Contributed by
Yiqun Lin.


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

Branch: refs/heads/HDFS-7240
Commit: 507447c816900cb0ddf3feae3a47b82c6d7ee975
Parents: 92945d0
Author: Xiaoyu Yao <xyao@apache.org>
Authored: Thu Aug 3 12:45:46 2017 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Thu Aug 3 12:45:46 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java | 10 +++++++++-
 .../java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/507447c8/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java
index 35a4c43..993be6a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KSMMetrics.java
@@ -32,6 +32,9 @@ import org.apache.hadoop.metrics2.lib.MutableCounterLong;
 @InterfaceAudience.Private
 @Metrics(about="Key Space Manager Metrics", context="dfs")
 public class KSMMetrics {
+  private static final String SOURCE_NAME =
+      KSMMetrics.class.getSimpleName();
+
   // KSM request type op metrics
   private @Metric MutableCounterLong numVolumeOps;
   private @Metric MutableCounterLong numBucketOps;
@@ -76,7 +79,7 @@ public class KSMMetrics {
 
   public static KSMMetrics create() {
     MetricsSystem ms = DefaultMetricsSystem.instance();
-    return ms.register("KSMMetrics",
+    return ms.register(SOURCE_NAME,
         "Key Space Manager Metrics",
         new KSMMetrics());
   }
@@ -365,4 +368,9 @@ public class KSMMetrics {
   public long getNumVolumeListFails() {
     return numVolumeListFails.value();
   }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(SOURCE_NAME);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/507447c8/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
index 4698089..8b586b0 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeySpaceManager.java
@@ -229,6 +229,7 @@ public class KeySpaceManager extends ServiceRuntimeInfo
       ksmRpcServer.stop();
       metadataManager.stop();
       httpServer.stop();
+      metrics.unRegister();
       unregisterMXBean();
     } catch (Exception e) {
       LOG.error("Key Space Manager stop failed.", e);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message