sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amis...@apache.org
Subject sentry git commit: SENTRY-2466: Create generic sentry store metrics (Arjun Mishra reviewed by Na Li, Haley Reeve)
Date Wed, 12 Dec 2018 21:33:11 GMT
Repository: sentry
Updated Branches:
  refs/heads/master 097cf0b05 -> 41b090fbe


SENTRY-2466: Create generic sentry store metrics (Arjun Mishra reviewed by Na Li, Haley Reeve)

Change-Id: Ib00fc0fe1105cce25829f62ad016fb38dfd7359e


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

Branch: refs/heads/master
Commit: 41b090fbe578f5e3cab4907883bc39dba50cee1d
Parents: 097cf0b
Author: amishra <amishra@cloudera.com>
Authored: Wed Dec 12 15:32:52 2018 -0600
Committer: amishra <amishra@cloudera.com>
Committed: Wed Dec 12 15:32:52 2018 -0600

----------------------------------------------------------------------
 .../org/apache/sentry/api/service/thrift/SentryMetrics.java   | 2 ++
 .../sentry/provider/db/service/persistent/SentryStore.java    | 7 +++++++
 .../provider/db/service/persistent/SentryStoreInterface.java  | 5 +++++
 .../api/service/thrift/TestSentryPolicyStoreProcessor.java    | 6 ++++++
 4 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/41b090fb/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
index 214d78c..534bb51 100644
--- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
+++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/api/service/thrift/SentryMetrics.java
@@ -167,6 +167,8 @@ public final class SentryMetrics {
       addGauge(SentryStore.class, "role_count", sentryStore.getRoleCountGauge());
       addGauge(SentryStore.class, "privilege_count",
               sentryStore.getPrivilegeCountGauge());
+      addGauge(SentryStore.class, "gm_privilege_count",
+          sentryStore.getGenericModelPrivilegeCountGauge());
       addGauge(SentryStore.class, "group_count", sentryStore.getGroupCountGauge());
       addGauge(SentryStore.class, "hms.waiters", sentryStore.getHMSWaitersCountGauge());
       addGauge(SentryStore.class, "hms.notification.id",

http://git-wip-us.apache.org/repos/asf/sentry/blob/41b090fb/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index e2d6c85..dcf4651 100644
--- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -463,6 +463,13 @@ public class SentryStore implements SentryStoreInterface {
   }
 
   /**
+   * @return Number of privileges
+   */
+  public Gauge<Long> getGenericModelPrivilegeCountGauge() {
+    return () -> getCount(MSentryGMPrivilege.class);
+  }
+
+  /**
    * @return number of groups
    */
   public Gauge<Long> getGroupCountGauge() {

http://git-wip-us.apache.org/repos/asf/sentry/blob/41b090fb/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreInterface.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreInterface.java
b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreInterface.java
index e48eea3..85ea6d1 100644
--- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreInterface.java
+++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStoreInterface.java
@@ -450,6 +450,11 @@ public interface SentryStoreInterface {
   Gauge<Long> getPrivilegeCountGauge();
 
   /**
+   * @return Number of privileges
+   */
+  Gauge<Long> getGenericModelPrivilegeCountGauge();
+
+  /**
    * @return current value of last processed notification ID
    */
   Gauge<Long> getLastNotificationIdGauge();

http://git-wip-us.apache.org/repos/asf/sentry/blob/41b090fb/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
index 8cea339..6f90fb4 100644
--- a/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
+++ b/sentry-service/sentry-service-server/src/test/java/org/apache/sentry/api/service/thrift/TestSentryPolicyStoreProcessor.java
@@ -104,6 +104,12 @@ public class TestSentryPolicyStoreProcessor {
         return 0L;
       }
     });
+    Mockito.when(sentryStore.getGenericModelPrivilegeCountGauge()).thenReturn(new Gauge<
Long >() {
+      @Override
+      public Long getValue() {
+        return 0L;
+      }
+    });
     Mockito.when(sentryStore.getGroupCountGauge()).thenReturn(new Gauge< Long >() {
       @Override
       public Long getValue() {


Mime
View raw message