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

    https://github.com/apache/storm/pull/2771#discussion_r204862238
  
    --- Diff: 
storm-server/src/main/java/org/apache/storm/metric/StormMetricsRegistry.java ---
    @@ -65,21 +67,41 @@ public static Meter registerMeter(final String name) {
          * @param <V> type of value the gauge measures
          */
         public static <V> void registerProvidedGauge(final String name, final 
Gauge<V> gauge) {
    -        register(name, gauge);
    +        DEFAULT_REGISTRY.register(name, gauge);
    +    }
    +
    +    public static Histogram registerHistogram(String name) {
    +        return registerHistogram(name, new 
ExponentiallyDecayingReservoir());
         }
     
         public static Histogram registerHistogram(String name, Reservoir 
reservoir) {
    -        return register(name, new Histogram(reservoir));
    +        return DEFAULT_REGISTRY.register(name, new Histogram(reservoir));
    +    }
    +
    +    public static Meter registerMeter(String name) {
    +        return DEFAULT_REGISTRY.register(name, new Meter());
    +    }
    +
    +    //Change the name to avoid name conflict in future Metrics release
    +    public static void registerMetricSet(MetricSet metrics) {
    +        DEFAULT_REGISTRY.registerAll(metrics);
         }
     
    -    public static void registerAll(final String prefix, MetricSet metrics) 
{
    -        register(prefix, metrics);
    +    public static void unregisterMetricSet(com.codahale.metrics.MetricSet 
metrics) {
    +        for (String s : metrics.getMetrics().keySet()) {
    +            DEFAULT_REGISTRY.remove(s);
    +        }
         }
     
    -    public static void unregister(final String name) {
    -        DEFAULT_REGISTRY.remove(name);
    +    public static Timer registerTimer(String name) {
    +        return DEFAULT_REGISTRY.register(name, new Timer());
         }
     
    +    /**
    +     * Start metrics reporter with this metric registry.
    --- End diff --
    
    Nit: It's not clear what `this` is here. Consider rewording to e.g. `Start 
metrics reporters for the registry singleton`.


---

Reply via email to