[java-opensaml COMMIT] /trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java
noreply at shibboleth.net
noreply at shibboleth.net
Sun Nov 6 20:28:24 EST 2016
Author: scantor
Date: Sun Nov 6 20:28:23 2016
New Revision: 4568
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4568&view=rev
Log:
Make Gauge registration conditional based on filter.
Modified:
trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java
Modified: trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java?rev=4568&r1=4567&r2=4568&view=diff
==============================================================================
--- trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java (original)
+++ trunk/opensaml-core/src/main/java/org/opensaml/core/metrics/FilteredMetricRegistry.java Sun Nov 6 20:28:23 2016
@@ -28,8 +28,10 @@
import org.opensaml.core.metrics.impl.DisabledTimer;
import com.codahale.metrics.Counter;
+import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
+import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.MetricSet;
@@ -136,4 +138,14 @@
}
}
+ /** {@inheritDoc} */
+ @Override public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {
+ if (!(metric instanceof Gauge)) {
+ return super.register(name, metric);
+ } else if (metricFilter != null && metricFilter.matches(name, metric)) {
+ return super.register(name, metric);
+ }
+ return metric;
+ }
+
}
More information about the commits
mailing list