[ 
https://issues.apache.org/jira/browse/YARN-11326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17617388#comment-17617388
 ] 

ASF GitHub Bot commented on YARN-11326:
---------------------------------------

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


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/federation/FederationStateStoreService.java:
##########
@@ -259,378 +261,190 @@ public Version loadVersion() {
   @Override
   public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration(
       GetSubClusterPolicyConfigurationRequest request) throws YarnException {
-    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;
-    }
+    FederationClientMethod clientMethod = new FederationClientMethod(
+        "getPolicyConfiguration", 
GetSubClusterPolicyConfigurationResponse.class, request);
+    return invoke(clientMethod, 
GetSubClusterPolicyConfigurationResponse.class);
   }
 
   @Override
   public SetSubClusterPolicyConfigurationResponse setPolicyConfiguration(
       SetSubClusterPolicyConfigurationRequest request) throws YarnException {
-    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;
-    }
+    FederationClientMethod clientMethod = new FederationClientMethod(
+        "setPolicyConfiguration", 
SetSubClusterPolicyConfigurationResponse.class, request);
+    return invoke(clientMethod, 
SetSubClusterPolicyConfigurationResponse.class);
   }
 
   @Override
   public GetSubClusterPoliciesConfigurationsResponse getPoliciesConfigurations(
       GetSubClusterPoliciesConfigurationsRequest request) throws YarnException 
{
-    try {
-      long startTime = clock.getTime();
-      GetSubClusterPoliciesConfigurationsResponse response =
-          stateStoreClient.getPoliciesConfigurations(request);
-      long stopTime = clock.getTime();
-      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
-          stopTime - startTime);
-      return response;
-    } catch (YarnException e) {
-      LOG.error("getPoliciesConfigurations error.", e);
-      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
-      throw e;
-    }
+    FederationClientMethod clientMethod = new FederationClientMethod(
+        "getPoliciesConfigurations", 
GetSubClusterPoliciesConfigurationsResponse.class, request);
+    return invoke(clientMethod, 
GetSubClusterPoliciesConfigurationsResponse.class);

Review Comment:
   I haven't finished the test yet, I will test the interface in junit Test.





> [Federation] Add RM FederationStateStoreService Metrics
> -------------------------------------------------------
>
>                 Key: YARN-11326
>                 URL: https://issues.apache.org/jira/browse/YARN-11326
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: federation, resourcemanager
>    Affects Versions: 3.4.0
>            Reporter: fanshilun
>            Assignee: fanshilun
>            Priority: Major
>              Labels: pull-request-available
>
> RM FederationStateStoreService lacks Metric information, increase Metric 
> information statistics.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to