|
@@ -26,6 +26,7 @@ import org.apache.hadoop.metrics2.annotation.Metric;
|
|
|
import org.apache.hadoop.metrics2.annotation.Metrics;
|
|
|
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
|
|
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
|
|
|
+import org.apache.hadoop.metrics2.lib.MutableQuantiles;
|
|
|
import org.apache.hadoop.metrics2.lib.MutableRate;
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
@@ -49,6 +50,8 @@ public class CapacitySchedulerMetrics {
|
|
|
@Metric("Scheduler commit success") MutableRate commitSuccess;
|
|
|
@Metric("Scheduler commit failure") MutableRate commitFailure;
|
|
|
@Metric("Scheduler node update") MutableRate nodeUpdate;
|
|
|
+ @Metric("Scheduler node heartbeat interval") MutableQuantiles
|
|
|
+ schedulerNodeHBInterval;
|
|
|
|
|
|
private static volatile CapacitySchedulerMetrics INSTANCE = null;
|
|
|
private static MetricsRegistry registry;
|
|
@@ -116,4 +119,13 @@ public class CapacitySchedulerMetrics {
|
|
|
public long getNumOfCommitSuccess() {
|
|
|
return this.commitSuccess.lastStat().numSamples();
|
|
|
}
|
|
|
+
|
|
|
+ public void addSchedulerNodeHBInterval(long heartbeatInterval) {
|
|
|
+ schedulerNodeHBInterval.add(heartbeatInterval);
|
|
|
+ }
|
|
|
+
|
|
|
+ @VisibleForTesting
|
|
|
+ public long getNumOfSchedulerNodeHBInterval() {
|
|
|
+ return this.schedulerNodeHBInterval.getEstimator().getCount();
|
|
|
+ }
|
|
|
}
|