HDFS-15849. ExpiredHeartbeats metric should be of Type.COUNTER. Contributed by Qi Zhu.
This commit is contained in:
parent
32353eb38a
commit
9501c698f4
|
@ -4632,7 +4632,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
return blockManager.getMissingReplOneBlocksCount();
|
return blockManager.getMissingReplOneBlocksCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Metric({"ExpiredHeartbeats", "Number of expired heartbeats"})
|
@Metric(value = {"ExpiredHeartbeats", "Number of expired heartbeats"},
|
||||||
|
type = Metric.Type.COUNTER)
|
||||||
public int getExpiredHeartbeats() {
|
public int getExpiredHeartbeats() {
|
||||||
return datanodeStatistics.getExpiredHeartbeats();
|
return datanodeStatistics.getExpiredHeartbeats();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hdfs;
|
package org.apache.hadoop.hdfs;
|
||||||
|
|
||||||
import static org.apache.hadoop.test.MetricsAsserts.assertGauge;
|
import static org.apache.hadoop.test.MetricsAsserts.assertCounter;
|
||||||
import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
|
import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class TestDatanodeReport {
|
||||||
assertReports(1, DatanodeReportType.DEAD, client, datanodes, null);
|
assertReports(1, DatanodeReportType.DEAD, client, datanodes, null);
|
||||||
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
assertGauge("ExpiredHeartbeats", 1, getMetrics("FSNamesystem"));
|
assertCounter("ExpiredHeartbeats", 1, getMetrics("FSNamesystem"));
|
||||||
} finally {
|
} finally {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue