[java-shib-profile] 01/02: Add getter for metric name for override by subclasses.

Scott Cantor cantor.2 at osu.edu
Thu Jul 25 17:50:47 UTC 2024


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch maint-5.1
in repository java-shib-profile.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-profile.git;a=commit;h=2f67b57b9d020b42a3beda8d68d8d79143baee4e

commit 2f67b57b9d020b42a3beda8d68d8d79143baee4e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 14 10:00:13 2024 -0400

    Add getter for metric name for override by subclasses.
---
 .../impl/DefaultRelyingPartyConfigurationResolver.java | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/shib-profile-impl/src/main/java/net/shibboleth/profile/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java b/shib-profile-impl/src/main/java/net/shibboleth/profile/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
index 06494c9..0d3399d 100644
--- a/shib-profile-impl/src/main/java/net/shibboleth/profile/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
+++ b/shib-profile-impl/src/main/java/net/shibboleth/profile/relyingparty/impl/DefaultRelyingPartyConfigurationResolver.java
@@ -188,6 +188,17 @@ public class DefaultRelyingPartyConfigurationResolver extends AbstractIdentifiab
         unverifiedConfiguration = configuration;
     }
     
+    /**
+     * Gets the metric name to use to use for counters to track use of configurations.
+     * 
+     * @return name for counter metrics
+     * 
+     * @since 5.1.3
+     */
+    @Nullable public String getMetricName() {
+        return metricName;
+    }
+    
     /**
      * Set name of metric to use for counters to track use of configurations.
      * 
@@ -218,7 +229,7 @@ public class DefaultRelyingPartyConfigurationResolver extends AbstractIdentifiab
         configIds.add(DEFAULT_RELYING_PARTY_COUNTER);
         configIds.add(UNVERIFIED_RELYING_PARTY_COUNTER);
         
-        final String localMetricName = metricName;
+        final String localMetricName = getMetricName();
         if (localMetricName != null && !configIds.isEmpty()) {
             // Build map of config IDs to counters.
             counterMap = configIds.stream().collect(
@@ -238,8 +249,9 @@ public class DefaultRelyingPartyConfigurationResolver extends AbstractIdentifiab
     
     /** {@inheritDoc} */
     @Override protected void doDestroy() {
-        if (metricName != null && counterGauge != null) {
-            MetricsSupport.remove(metricName, counterGauge);
+        final String localMetricName = getMetricName();
+        if (localMetricName != null && counterGauge != null) {
+            MetricsSupport.remove(localMetricName, counterGauge);
         }
         
         super.doDestroy();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list