You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/10/06 06:55:00 UTC

[jira] [Commented] (YARN-11326) [Federation] Add RM FederationStateStoreService Metrics

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

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

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


##########
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(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("getPoliciesConfigurations error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public SubClusterRegisterResponse registerSubCluster(
       SubClusterRegisterRequest registerSubClusterRequest)
       throws YarnException {
-    return stateStoreClient.registerSubCluster(registerSubClusterRequest);
+    try {
+      long startTime = clock.getTime();
+      SubClusterRegisterResponse response =
+          stateStoreClient.registerSubCluster(registerSubClusterRequest);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("registerSubCluster error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public SubClusterDeregisterResponse deregisterSubCluster(
       SubClusterDeregisterRequest subClusterDeregisterRequest)
       throws YarnException {
-    return stateStoreClient.deregisterSubCluster(subClusterDeregisterRequest);
+    try {
+      long startTime = clock.getTime();
+      SubClusterDeregisterResponse response =
+          stateStoreClient.deregisterSubCluster(subClusterDeregisterRequest);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("deregisterSubCluster error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public SubClusterHeartbeatResponse subClusterHeartbeat(
       SubClusterHeartbeatRequest subClusterHeartbeatRequest)
       throws YarnException {
-    return stateStoreClient.subClusterHeartbeat(subClusterHeartbeatRequest);
+    try {
+      long startTime = clock.getTime();
+      SubClusterHeartbeatResponse response =
+          stateStoreClient.subClusterHeartbeat(subClusterHeartbeatRequest);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("subClusterHeartbeat error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public GetSubClusterInfoResponse getSubCluster(
       GetSubClusterInfoRequest subClusterRequest) throws YarnException {
-    return stateStoreClient.getSubCluster(subClusterRequest);
+    try {
+      long startTime = clock.getTime();
+      GetSubClusterInfoResponse response =
+          stateStoreClient.getSubCluster(subClusterRequest);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("getSubCluster error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public GetSubClustersInfoResponse getSubClusters(
       GetSubClustersInfoRequest subClustersRequest) throws YarnException {
-    return stateStoreClient.getSubClusters(subClustersRequest);
+    try {
+      long startTime = clock.getTime();
+      GetSubClustersInfoResponse response =
+          stateStoreClient.getSubClusters(subClustersRequest);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(
+          stopTime - startTime);
+      return response;
+    } catch (YarnException e) {
+      LOG.error("getSubClusters error.", e);
+      FederationStateStoreServiceMetrics.failedStateStoreServiceCall();
+      throw e;
+    }
   }
 
   @Override
   public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster(
       AddApplicationHomeSubClusterRequest request) throws YarnException {
-    return stateStoreClient.addApplicationHomeSubCluster(request);
+    try {
+      long startTime = clock.getTime();
+      AddApplicationHomeSubClusterResponse response =
+          stateStoreClient.addApplicationHomeSubCluster(request);
+      long stopTime = clock.getTime();
+      FederationStateStoreServiceMetrics.succeededStateStoreServiceCall(

Review Comment:
   I will fix it.





> [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: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org