virajjasani commented on code in PR #5497:
URL: https://github.com/apache/hadoop/pull/5497#discussion_r1146493478
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/store/driver/TestStateStoreDriverBase.java:
##########
@@ -574,6 +580,26 @@ private static Map<String, Class<?>> getFields(BaseRecord
record) {
return getters;
}
+ public void testCacheLoadMetrics(StateStoreDriver driver, int numRefresh)
+ throws IOException, IllegalArgumentException {
+ StateStoreMetrics metrics = stateStore.getMetrics();
+ final Query<MountTable> query = new Query<>(MountTable.newInstance());
+ driver.getMultiple(MountTable.class, query);
+ final Map<String, MutableRate> cacheLoadMetrics =
metrics.getCacheLoadMetrics();
+ final MutableRate mountTableCache =
cacheLoadMetrics.get("CacheMountTableLoad");
+ assertNotNull("CacheMountTableLoad should be present in the state store
metrics",
+ mountTableCache);
+ // CacheMountTableLoadNumOps
+ final long mountTableCacheLoadNumOps =
mountTableCache.lastStat().numSamples();
+ assertEquals("Num of samples collected should match with " + numRefresh +
". Actual value: "
+ + mountTableCacheLoadNumOps, numRefresh, mountTableCacheLoadNumOps);
+ // CacheMountTableLoadAvgTime
+ final double mountTableCacheLoadAvgTime =
mountTableCache.lastStat().mean();
+ assertTrue(
+ "Mean time duration for cache load is expected to be less than 2000
ms. Actual value: "
+ + mountTableCacheLoadAvgTime, mountTableCacheLoadAvgTime < 2000d);
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]