Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2771#discussion_r207601720
  
    --- 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 --
    
    I think we can make the registry non-static without it being a huge hassle 
https://github.com/apache/storm/pull/2783. I'll rebase it once 
https://github.com/apache/storm/pull/2752 goes in, and hopefully we can use it 
to resolve https://github.com/apache/storm/pull/2714.
    
    Regarding the subclassing, I'm wondering if we should instead go ask the 
Dropwizard guys whether the inability to use `getOrAdd` for MetricSets is 
intended, and if not whether they'd be open to adding a method to 
MetricRegistry to allow it. If we're hitting this issue, other people probably 
are too, and I'd much rather fix it in the library than try to hack around it 
here.
    
    What do you think @zd-project?


---

Reply via email to