You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/10/06 06:54:18 UTC

[GitHub] [hadoop] slfan1989 commented on a diff in pull request #4963: YARN-11326. [Federation] Add RM FederationStateStoreService Metrics.

slfan1989 commented on code in PR #4963:
URL: https://github.com/apache/hadoop/pull/4963#discussion_r988614649


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java:
##########
@@ -253,129 +259,378 @@ public Version loadVersion() {
   @Override
   public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration(
       GetSubClusterPolicyConfigurationRequest request) throws YarnException {
-    return stateStoreClient.getPolicyConfiguration(request);
+    try {
+      long startTime = clock.getTime();
+      GetSubClusterPolicyConfigurationResponse response =
+          stateStoreClient.getPolicyConfiguration(request);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(

Review Comment:
   Thanks for your help reviewing the code, I will fix it.



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java:
##########
@@ -253,129 +259,378 @@ public Version loadVersion() {
   @Override
   public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration(
       GetSubClusterPolicyConfigurationRequest request) throws YarnException {
-    return stateStoreClient.getPolicyConfiguration(request);
+    try {
+      long startTime = clock.getTime();
+      GetSubClusterPolicyConfigurationResponse response =
+          stateStoreClient.getPolicyConfiguration(request);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("getPolicyConfiguration error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public SetSubClusterPolicyConfigurationResponse setPolicyConfiguration(
       SetSubClusterPolicyConfigurationRequest request) throws YarnException {
-    return stateStoreClient.setPolicyConfiguration(request);
+    try {
+      long startTime = clock.getTime();
+      SetSubClusterPolicyConfigurationResponse response =
+          stateStoreClient.setPolicyConfiguration(request);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("setPolicyConfiguration error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public GetSubClusterPoliciesConfigurationsResponse getPoliciesConfigurations(
       GetSubClusterPoliciesConfigurationsRequest request) throws YarnException {
-    return stateStoreClient.getPoliciesConfigurations(request);
+    try {
+      long startTime = clock.getTime();
+      GetSubClusterPoliciesConfigurationsResponse response =
+          stateStoreClient.getPoliciesConfigurations(request);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(

Review Comment:
   I will fix it.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org