[java-shib-shared] 01/01: IDP-2272 Expose LDAP metrics

Rod Widdowson rdw at steadingsoftware.com
Tue Apr 1 10:21:40 UTC 2025


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

rdw pushed a commit to branch dev/IDP-2272
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=660591bc36e9df969b0d979295fa7e2c32f33f06

commit 660591bc36e9df969b0d979295fa7e2c32f33f06
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Apr 1 11:02:35 2025 +0100

    IDP-2272 Expose LDAP metrics
    
    https://shibboleth.atlassian.net/browse/IDP-2272
    
    Introduce a bean whose sole purpose is o act as a bus between
    ldaptive and metrics.  This is autowired into the ldaptive components
    and explicitly wired into the ldap metrics.
    
    Contents TBF
---
 .../shared/metrics/LDAPMetricAccumulator.java      | 70 ++++++++++++++++++++++
 .../shibboleth/shared/metrics/package-info.java    | 19 ++++++
 2 files changed, 89 insertions(+)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/metrics/LDAPMetricAccumulator.java b/shib-support/src/main/java/net/shibboleth/shared/metrics/LDAPMetricAccumulator.java
new file mode 100644
index 00000000..65e7a817
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/shared/metrics/LDAPMetricAccumulator.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.shibboleth.shared.metrics;
+
+/**
+ * An class to inject into LDAPTIVE components which accumlates events from
+ * ldaptive and summarises them out to the metrics package.
+ */
+public class LDAPMetricAccumulator {
+
+	/** How many times has {@link LDAPMetricAccumulator#incrementEventOne()} been called. */
+	private int eventOneCount = 0;
+
+	/** How many times has {@link LDAPMetricAccumulator#incrementEventTwo()} been called. */
+	private int eventTwoCount = 0;
+
+	/** How many times has {@link LDAPMetricAccumulator#incrementEventThree()} been called. */
+	private int eventThreeCount = 0;
+
+	/** Called by the ldaptive aware component when "thing one" happens. */
+	public void incrementEventOne() {
+		eventOneCount++;
+	}
+
+	/**
+	 * How many times has {@link #incrementEventOne()} been called.
+	 * @return the count.
+	 */
+	public int getEventOneCount() {
+		return eventOneCount;
+	}
+
+	/** Called by the ldaptive aware component when "thing two" happens. */
+	public void incrementEventTwo() {
+		eventTwoCount++;
+	}
+
+	/**
+	 * How many times has {@link #incrementEventTwo()} been called.
+	 * @return the count.
+	 */
+	public int getEventTwoCount() {
+		return eventTwoCount;
+	}
+
+	/** Called by the ldaptive aware component when "thing three" happens. */
+	public void incrementEventThree() {
+		eventThreeCount++;
+	}
+
+	/**
+	 * How many times has {@link #incrementEventThree()} been called.
+	 * @return the count.
+	 */
+	public int getEventThreeCount() {
+		return eventThreeCount;
+	}
+
+}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/metrics/package-info.java b/shib-support/src/main/java/net/shibboleth/shared/metrics/package-info.java
new file mode 100644
index 00000000..cfa7be18
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/shared/metrics/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Classes that to support metrics across the stack. */
+ at NonnullElements
+package net.shibboleth.shared.metrics;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;

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


More information about the commits mailing list