HDFS-12247. Ozone: KeySpaceManager should unregister KSMMetrics upon stop. Contributed by Yiqun Lin.
This commit is contained in:
parent
9cf40547ce
commit
37a0ab5ca3
@ -32,6 +32,9 @@ import org.apache.hadoop.metrics2.lib.MutableCounterLong;
|
|||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
@Metrics(about="Key Space Manager Metrics", context="dfs")
|
@Metrics(about="Key Space Manager Metrics", context="dfs")
|
||||||
public class KSMMetrics {
|
public class KSMMetrics {
|
||||||
|
private static final String SOURCE_NAME =
|
||||||
|
KSMMetrics.class.getSimpleName();
|
||||||
|
|
||||||
// KSM request type op metrics
|
// KSM request type op metrics
|
||||||
private @Metric MutableCounterLong numVolumeOps;
|
private @Metric MutableCounterLong numVolumeOps;
|
||||||
private @Metric MutableCounterLong numBucketOps;
|
private @Metric MutableCounterLong numBucketOps;
|
||||||
@ -76,7 +79,7 @@ public class KSMMetrics {
|
|||||||
|
|
||||||
public static KSMMetrics create() {
|
public static KSMMetrics create() {
|
||||||
MetricsSystem ms = DefaultMetricsSystem.instance();
|
MetricsSystem ms = DefaultMetricsSystem.instance();
|
||||||
return ms.register("KSMMetrics",
|
return ms.register(SOURCE_NAME,
|
||||||
"Key Space Manager Metrics",
|
"Key Space Manager Metrics",
|
||||||
new KSMMetrics());
|
new KSMMetrics());
|
||||||
}
|
}
|
||||||
@ -365,4 +368,9 @@ public class KSMMetrics {
|
|||||||
public long getNumVolumeListFails() {
|
public long getNumVolumeListFails() {
|
||||||
return numVolumeListFails.value();
|
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();
|
ksmRpcServer.stop();
|
||||||
metadataManager.stop();
|
metadataManager.stop();
|
||||||
httpServer.stop();
|
httpServer.stop();
|
||||||
|
metrics.unRegister();
|
||||||
unregisterMXBean();
|
unregisterMXBean();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Key Space Manager stop failed.", e);
|
LOG.error("Key Space Manager stop failed.", e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user