HDFS-12247. Ozone: KeySpaceManager should unregister KSMMetrics upon stop. Contributed by Yiqun Lin.
This commit is contained in:
parent
92945d01b2
commit
507447c816
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue