[java-identity-provider] branch maint-3.4 updated: IDP-1490 - add system hostname to metrics

Scott Cantor cantor.2 at osu.edu
Wed Sep 4 15:23:07 EDT 2019


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

scantor pushed a commit to branch maint-3.4
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=1f57a813c20b1955676e1676a5c413caf22444ac

The following commit(s) were added to refs/heads/maint-3.4 by this push:
       new  1f57a81   IDP-1490 - add system hostname to metrics
1f57a81 is described below

commit 1f57a813c20b1955676e1676a5c413caf22444ac
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Sep 4 15:21:21 2019 -0400

    IDP-1490 - add system hostname to metrics
    
    https://issues.shibboleth.net/jira/browse/IDP-1490
    (cherry picked from commit e4aaaf704a9e25a9a419f36a197323d375ccf217)
---
 .../java/net/shibboleth/idp/metrics/impl/CoreGaugeSet.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/idp-core/src/main/java/net/shibboleth/idp/metrics/impl/CoreGaugeSet.java b/idp-core/src/main/java/net/shibboleth/idp/metrics/impl/CoreGaugeSet.java
index f0d7e19..1fbeb7c 100644
--- a/idp-core/src/main/java/net/shibboleth/idp/metrics/impl/CoreGaugeSet.java
+++ b/idp-core/src/main/java/net/shibboleth/idp/metrics/impl/CoreGaugeSet.java
@@ -24,6 +24,8 @@ import com.codahale.metrics.RatioGauge;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -44,6 +46,18 @@ public class CoreGaugeSet implements MetricSet, MetricFilter {
         gauges = new HashMap<>();
         
         gauges.put(
+                "host.name",
+                new Gauge<String>() {
+                    public String getValue() {
+                        try {
+                            return InetAddress.getLocalHost().getHostName();
+                        } catch (final UnknownHostException e) {
+                            return null;
+                        }
+                    }
+                });
+
+        gauges.put(
                 "os.name",
                 new Gauge<String>() {
                     public String getValue() {

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


More information about the commits mailing list