HDFS-16998. RBF: Add ops metrics for getSlowDatanodeReport in RouterClientActivity (#5615)

This commit is contained in:
Viraj Jasani 2023-05-04 06:45:40 -10:00 committed by GitHub
parent 27776ac45e
commit ceb8878d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -147,6 +147,7 @@ public class RouterClientMetrics {
@Metric private MutableCounterLong satisfyStoragePolicyOps;
@Metric private MutableCounterLong getHAServiceStateOps;
@Metric private MutableCounterLong otherOps;
@Metric private MutableCounterLong getSlowDatanodeReportOps;
// private ConcurrentOps
@Metric private MutableCounterLong concurrentSetReplicationOps;
@ -184,6 +185,7 @@ public class RouterClientMetrics {
@Metric private MutableCounterLong concurrentSetQuotaOps;
@Metric private MutableCounterLong concurrentGetQuotaUsageOps;
@Metric private MutableCounterLong concurrentOtherOps;
@Metric private MutableCounterLong concurrentGetSlowDatanodeReportOps;
RouterClientMetrics(String processName, String sessionId) {
registry.tag(ProcessName, processName).tag(SessionId, sessionId);
@ -525,6 +527,9 @@ public class RouterClientMetrics {
case "getHAServiceState":
getHAServiceStateOps.incr();
break;
case "getSlowDatanodeReport":
getSlowDatanodeReportOps.incr();
break;
default:
otherOps.incr();
}
@ -638,6 +643,9 @@ public class RouterClientMetrics {
case "getQuotaUsage":
concurrentGetQuotaUsageOps.incr();
break;
case "getSlowDatanodeReport":
concurrentGetSlowDatanodeReportOps.incr();
break;
default :
concurrentOtherOps.incr();
}

View File

@ -170,5 +170,12 @@ public class TestRouterClientMetrics {
getMetrics(ROUTER_METRICS));
}
@Test
public void testGetSlowDatanodeReport() throws Exception {
router.getRpcServer().getSlowDatanodeReport();
assertCounter("GetSlowDatanodeReportOps", 2L, getMetrics(ROUTER_METRICS));
assertCounter("ConcurrentGetSlowDatanodeReportOps", 1L, getMetrics(ROUTER_METRICS));
}
}