From ceb8878d4fa35446c67f0b3a68f432e61ff9f5ad Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Thu, 4 May 2023 06:45:40 -1000 Subject: [PATCH] HDFS-16998. RBF: Add ops metrics for getSlowDatanodeReport in RouterClientActivity (#5615) --- .../server/federation/router/RouterClientMetrics.java | 8 ++++++++ .../federation/metrics/TestRouterClientMetrics.java | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientMetrics.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientMetrics.java index ac388194aa..5c4b8ff022 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientMetrics.java @@ -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 void incInvokedMethod(Method method) { case "getHAServiceState": getHAServiceStateOps.incr(); break; + case "getSlowDatanodeReport": + getSlowDatanodeReportOps.incr(); + break; default: otherOps.incr(); } @@ -638,6 +643,9 @@ public void incInvokedConcurrent(Method method){ case "getQuotaUsage": concurrentGetQuotaUsageOps.incr(); break; + case "getSlowDatanodeReport": + concurrentGetSlowDatanodeReportOps.incr(); + break; default : concurrentOtherOps.incr(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/metrics/TestRouterClientMetrics.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/metrics/TestRouterClientMetrics.java index 3397718745..d091cf3616 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/metrics/TestRouterClientMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/metrics/TestRouterClientMetrics.java @@ -170,5 +170,12 @@ public void testGetDatanodeReport() throws Exception { getMetrics(ROUTER_METRICS)); } + @Test + public void testGetSlowDatanodeReport() throws Exception { + router.getRpcServer().getSlowDatanodeReport(); + assertCounter("GetSlowDatanodeReportOps", 2L, getMetrics(ROUTER_METRICS)); + assertCounter("ConcurrentGetSlowDatanodeReportOps", 1L, getMetrics(ROUTER_METRICS)); + } + }