[5/8] hadoop git commit: YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)

2017-09-21 Thread curino
YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)

(cherry picked from commit 75abc9a8e2cf1c7d2c574ede720df59421512be3)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ac090b38
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ac090b38
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ac090b38

Branch: refs/heads/branch-2
Commit: ac090b38ad54f78f59ec2ec0f73c6c4d7664d4cb
Parents: 261f769
Author: Arun Suresh 
Authored: Mon Aug 21 22:43:08 2017 -0700
Committer: Carlo Curino 
Committed: Thu Sep 21 18:09:30 2017 -0700

--
 .../store/impl/SQLFederationStateStore.java |  79 
 .../FederationStateStoreClientMetrics.java  | 184 +++
 .../federation/store/metrics/package-info.java  |  17 ++
 .../TestFederationStateStoreClientMetrics.java  | 146 +++
 4 files changed, 426 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ac090b38/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
index 63d8e42..533f9c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
 import 
org.apache.hadoop.yarn.server.federation.store.exception.FederationStateStoreInvalidInputException;
+import 
org.apache.hadoop.yarn.server.federation.store.metrics.FederationStateStoreClientMetrics;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
 import 
org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
@@ -72,6 +73,8 @@ import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationMembership
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationStateStoreUtils;
 import org.apache.hadoop.yarn.server.records.Version;
+import org.apache.hadoop.yarn.util.Clock;
+import org.apache.hadoop.yarn.util.MonotonicClock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -137,6 +140,7 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   private String url;
   private int maximumPoolSize;
   private HikariDataSource dataSource = null;
+  private final Clock clock = new MonotonicClock();
 
   @Override
   public void init(Configuration conf) throws YarnException {
@@ -203,7 +207,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means the call
   // did not add a new subcluster into FederationStateStore
@@ -222,8 +228,11 @@ public class SQLFederationStateStore implements 
FederationStateStore {
 
   LOG.info(
   "Registered the SubCluster " + subClusterId + " into the 
StateStore");
+  FederationStateStoreClientMetrics
+  .succeededStateStoreCall(stopTime - startTime);
 
 } catch (SQLException e) {
+  FederationStateStoreClientMetrics.failedStateStoreCall();
   FederationStateStoreUtils.logAndThrowRetriableException(LOG,
   "Unable to register the SubCluster " + subClusterId
   + " into the StateStore",
@@ -260,7 +269,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 

[30/50] [abbrv] hadoop git commit: YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)

2017-08-24 Thread asuresh
YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/75abc9a8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/75abc9a8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/75abc9a8

Branch: refs/heads/YARN-5972
Commit: 75abc9a8e2cf1c7d2c574ede720df59421512be3
Parents: b6bfb2f
Author: Arun Suresh 
Authored: Mon Aug 21 22:43:08 2017 -0700
Committer: Arun Suresh 
Committed: Mon Aug 21 22:43:08 2017 -0700

--
 .../store/impl/SQLFederationStateStore.java |  79 
 .../FederationStateStoreClientMetrics.java  | 184 +++
 .../federation/store/metrics/package-info.java  |  17 ++
 .../TestFederationStateStoreClientMetrics.java  | 146 +++
 4 files changed, 426 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/75abc9a8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
index 63d8e42..533f9c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
 import 
org.apache.hadoop.yarn.server.federation.store.exception.FederationStateStoreInvalidInputException;
+import 
org.apache.hadoop.yarn.server.federation.store.metrics.FederationStateStoreClientMetrics;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
 import 
org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
@@ -72,6 +73,8 @@ import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationMembership
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationStateStoreUtils;
 import org.apache.hadoop.yarn.server.records.Version;
+import org.apache.hadoop.yarn.util.Clock;
+import org.apache.hadoop.yarn.util.MonotonicClock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -137,6 +140,7 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   private String url;
   private int maximumPoolSize;
   private HikariDataSource dataSource = null;
+  private final Clock clock = new MonotonicClock();
 
   @Override
   public void init(Configuration conf) throws YarnException {
@@ -203,7 +207,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means the call
   // did not add a new subcluster into FederationStateStore
@@ -222,8 +228,11 @@ public class SQLFederationStateStore implements 
FederationStateStore {
 
   LOG.info(
   "Registered the SubCluster " + subClusterId + " into the 
StateStore");
+  FederationStateStoreClientMetrics
+  .succeededStateStoreCall(stopTime - startTime);
 
 } catch (SQLException e) {
+  FederationStateStoreClientMetrics.failedStateStoreCall();
   FederationStateStoreUtils.logAndThrowRetriableException(LOG,
   "Unable to register the SubCluster " + subClusterId
   + " into the StateStore",
@@ -260,7 +269,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means 

[16/36] hadoop git commit: YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)

2017-08-22 Thread jhung
YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/75abc9a8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/75abc9a8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/75abc9a8

Branch: refs/heads/YARN-5734
Commit: 75abc9a8e2cf1c7d2c574ede720df59421512be3
Parents: b6bfb2f
Author: Arun Suresh 
Authored: Mon Aug 21 22:43:08 2017 -0700
Committer: Arun Suresh 
Committed: Mon Aug 21 22:43:08 2017 -0700

--
 .../store/impl/SQLFederationStateStore.java |  79 
 .../FederationStateStoreClientMetrics.java  | 184 +++
 .../federation/store/metrics/package-info.java  |  17 ++
 .../TestFederationStateStoreClientMetrics.java  | 146 +++
 4 files changed, 426 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/75abc9a8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
index 63d8e42..533f9c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
 import 
org.apache.hadoop.yarn.server.federation.store.exception.FederationStateStoreInvalidInputException;
+import 
org.apache.hadoop.yarn.server.federation.store.metrics.FederationStateStoreClientMetrics;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
 import 
org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
@@ -72,6 +73,8 @@ import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationMembership
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationStateStoreUtils;
 import org.apache.hadoop.yarn.server.records.Version;
+import org.apache.hadoop.yarn.util.Clock;
+import org.apache.hadoop.yarn.util.MonotonicClock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -137,6 +140,7 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   private String url;
   private int maximumPoolSize;
   private HikariDataSource dataSource = null;
+  private final Clock clock = new MonotonicClock();
 
   @Override
   public void init(Configuration conf) throws YarnException {
@@ -203,7 +207,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means the call
   // did not add a new subcluster into FederationStateStore
@@ -222,8 +228,11 @@ public class SQLFederationStateStore implements 
FederationStateStore {
 
   LOG.info(
   "Registered the SubCluster " + subClusterId + " into the 
StateStore");
+  FederationStateStoreClientMetrics
+  .succeededStateStoreCall(stopTime - startTime);
 
 } catch (SQLException e) {
+  FederationStateStoreClientMetrics.failedStateStoreCall();
   FederationStateStoreUtils.logAndThrowRetriableException(LOG,
   "Unable to register the SubCluster " + subClusterId
   + " into the StateStore",
@@ -260,7 +269,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means 

[01/42] hadoop git commit: YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh) [Forced Update!]

2017-08-22 Thread wangda
Repository: hadoop
Updated Branches:
  refs/heads/YARN-3926 d84143733 -> b78f1b730 (forced update)


YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/75abc9a8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/75abc9a8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/75abc9a8

Branch: refs/heads/YARN-3926
Commit: 75abc9a8e2cf1c7d2c574ede720df59421512be3
Parents: b6bfb2f
Author: Arun Suresh 
Authored: Mon Aug 21 22:43:08 2017 -0700
Committer: Arun Suresh 
Committed: Mon Aug 21 22:43:08 2017 -0700

--
 .../store/impl/SQLFederationStateStore.java |  79 
 .../FederationStateStoreClientMetrics.java  | 184 +++
 .../federation/store/metrics/package-info.java  |  17 ++
 .../TestFederationStateStoreClientMetrics.java  | 146 +++
 4 files changed, 426 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/75abc9a8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
index 63d8e42..533f9c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
 import 
org.apache.hadoop.yarn.server.federation.store.exception.FederationStateStoreInvalidInputException;
+import 
org.apache.hadoop.yarn.server.federation.store.metrics.FederationStateStoreClientMetrics;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
 import 
org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
@@ -72,6 +73,8 @@ import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationMembership
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationStateStoreUtils;
 import org.apache.hadoop.yarn.server.records.Version;
+import org.apache.hadoop.yarn.util.Clock;
+import org.apache.hadoop.yarn.util.MonotonicClock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -137,6 +140,7 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   private String url;
   private int maximumPoolSize;
   private HikariDataSource dataSource = null;
+  private final Clock clock = new MonotonicClock();
 
   @Override
   public void init(Configuration conf) throws YarnException {
@@ -203,7 +207,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means the call
   // did not add a new subcluster into FederationStateStore
@@ -222,8 +228,11 @@ public class SQLFederationStateStore implements 
FederationStateStore {
 
   LOG.info(
   "Registered the SubCluster " + subClusterId + " into the 
StateStore");
+  FederationStateStoreClientMetrics
+  .succeededStateStoreCall(stopTime - startTime);
 
 } catch (SQLException e) {
+  FederationStateStoreClientMetrics.failedStateStoreCall();
   FederationStateStoreUtils.logAndThrowRetriableException(LOG,
   "Unable to register the SubCluster " + subClusterId
   + " into the StateStore",
@@ -260,7 +269,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  

hadoop git commit: YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)

2017-08-21 Thread asuresh
Repository: hadoop
Updated Branches:
  refs/heads/trunk b6bfb2fcb -> 75abc9a8e


YARN-5603. Metrics for Federation StateStore. (Ellen Hui via asuresh)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/75abc9a8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/75abc9a8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/75abc9a8

Branch: refs/heads/trunk
Commit: 75abc9a8e2cf1c7d2c574ede720df59421512be3
Parents: b6bfb2f
Author: Arun Suresh 
Authored: Mon Aug 21 22:43:08 2017 -0700
Committer: Arun Suresh 
Committed: Mon Aug 21 22:43:08 2017 -0700

--
 .../store/impl/SQLFederationStateStore.java |  79 
 .../FederationStateStoreClientMetrics.java  | 184 +++
 .../federation/store/metrics/package-info.java  |  17 ++
 .../TestFederationStateStoreClientMetrics.java  | 146 +++
 4 files changed, 426 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/75abc9a8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
--
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
index 63d8e42..533f9c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/SQLFederationStateStore.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
 import 
org.apache.hadoop.yarn.server.federation.store.exception.FederationStateStoreInvalidInputException;
+import 
org.apache.hadoop.yarn.server.federation.store.metrics.FederationStateStoreClientMetrics;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
 import 
org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
 import 
org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
@@ -72,6 +73,8 @@ import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationMembership
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
 import 
org.apache.hadoop.yarn.server.federation.store.utils.FederationStateStoreUtils;
 import org.apache.hadoop.yarn.server.records.Version;
+import org.apache.hadoop.yarn.util.Clock;
+import org.apache.hadoop.yarn.util.MonotonicClock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -137,6 +140,7 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   private String url;
   private int maximumPoolSize;
   private HikariDataSource dataSource = null;
+  private final Clock clock = new MonotonicClock();
 
   @Override
   public void init(Configuration conf) throws YarnException {
@@ -203,7 +207,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(9, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime = clock.getTime();
 
   // Check the ROWCOUNT value, if it is equal to 0 it means the call
   // did not add a new subcluster into FederationStateStore
@@ -222,8 +228,11 @@ public class SQLFederationStateStore implements 
FederationStateStore {
 
   LOG.info(
   "Registered the SubCluster " + subClusterId + " into the 
StateStore");
+  FederationStateStoreClientMetrics
+  .succeededStateStoreCall(stopTime - startTime);
 
 } catch (SQLException e) {
+  FederationStateStoreClientMetrics.failedStateStoreCall();
   FederationStateStoreUtils.logAndThrowRetriableException(LOG,
   "Unable to register the SubCluster " + subClusterId
   + " into the StateStore",
@@ -260,7 +269,9 @@ public class SQLFederationStateStore implements 
FederationStateStore {
   cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
 
   // Execute the query
+  long startTime = clock.getTime();
   cstmt.executeUpdate();
+  long stopTime =