Github user zd-project commented on a diff in the pull request: https://github.com/apache/storm/pull/2771#discussion_r207640687 --- Diff: storm-server/src/main/java/org/apache/storm/metric/StormMetricsRegistry.java --- @@ -12,28 +12,30 @@ package org.apache.storm.metric; +import com.codahale.metrics.ExponentiallyDecayingReservoir; import com.codahale.metrics.Gauge; import com.codahale.metrics.Histogram; import com.codahale.metrics.Meter; import com.codahale.metrics.Metric; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.MetricSet; import com.codahale.metrics.Reservoir; + import java.util.Map; import java.util.concurrent.Callable; + +import com.codahale.metrics.Timer; +import org.apache.commons.lang.StringUtils; import org.apache.storm.daemon.metrics.MetricsUtils; import org.apache.storm.daemon.metrics.reporters.PreparableReporter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("unchecked") -public class StormMetricsRegistry { - private static final MetricRegistry DEFAULT_REGISTRY = new MetricRegistry(); +public class StormMetricsRegistry extends MetricRegistry { --- End diff -- Our customization upon MetricsRegistry is actually very similar to the wrapping methods of `#getOrAdd`, such as `gauge`, `timer`, `meter`, and `histogram`. They do not have a way to eliminate double registration of MetricSet though, although we could avoid this altogether with a non-static registry. In addition, I think we should probably upgrading to a newer version of Dropwizard, since current version (3.1.0) is about to be EOL. Their 4.x has a lot of improvement and provides more features on top of Java 8.
---