You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ag...@apache.org on 2020/06/03 14:25:07 UTC

[storm] branch master updated: STORM-3642 update AutoTGT metric to new API

This is an automated email from the ASF dual-hosted git repository.

agresch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e3e2b5  STORM-3642 update AutoTGT metric to new API
     new cfc28e3  Merge pull request #3278 from agresch/agresch_storm_3642
2e3e2b5 is described below

commit 2e3e2b5c674a1262d1ae9f4162c17c409fccbb32
Author: Aaron Gresch <ag...@yahoo-inc.com>
AuthorDate: Mon Jun 1 16:11:11 2020 -0500

    STORM-3642 update AutoTGT metric to new API
---
 .../jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java  | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
index f7fdda7..f907a23 100644
--- a/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
+++ b/storm-client/src/jvm/org/apache/storm/security/auth/kerberos/AutoTGT.java
@@ -12,6 +12,7 @@
 
 package org.apache.storm.security.auth.kerberos;
 
+import com.codahale.metrics.Gauge;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.security.Principal;
@@ -28,7 +29,6 @@ import javax.security.auth.kerberos.KerberosTicket;
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginContext;
 import javax.xml.bind.DatatypeConverter;
-import org.apache.storm.Config;
 import org.apache.storm.metric.api.IMetricsRegistrant;
 import org.apache.storm.security.auth.ClientAuthUtils;
 import org.apache.storm.security.auth.IAutoCredentials;
@@ -114,6 +114,7 @@ public class AutoTGT implements IAutoCredentials, ICredentialsRenewer, IMetricsR
         LOG.info("Got a Subject " + s);
     }
 
+    @Override
     public void prepare(Map<String, Object> conf) {
         this.conf = conf;
     }
@@ -280,7 +281,11 @@ public class AutoTGT implements IAutoCredentials, ICredentialsRenewer, IMetricsR
 
     @Override
     public void registerMetrics(TopologyContext topoContext, Map<String, Object> topoConf) {
-        int bucketSize = ((Number) topoConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS)).intValue();
-        topoContext.registerMetric("TGT-TimeToExpiryMsecs", () -> getMsecsUntilExpiration(), bucketSize);
+        topoContext.registerGauge("TGT-TimeToExpiryMsecs", new Gauge<Long>() {
+            @Override
+            public Long getValue() {
+                return getMsecsUntilExpiration();
+            }
+        });
     }
 }