Github user zd-project commented on a diff in the pull request:
https://github.com/apache/storm/pull/2771#discussion_r204920511
--- Diff:
storm-server/src/main/java/org/apache/storm/metric/StormMetricsRegistry.java ---
@@ -88,19 +110,24 @@ public static void startMetricsReporters(Map<String,
Object> topoConf) {
}
}
- private static <T extends Metric> T register(final String name, T
metric) {
- T ret;
- try {
- ret = DEFAULT_REGISTRY.register(name, metric);
- } catch (IllegalArgumentException e) {
- // swallow IllegalArgumentException when the metric exists
already
--- End diff --
DEFAULT_REGISTRY.getMetrics().get(name) won't properly capture registration
of a MetricSet because under the hood MetricRegistry registers each metric in
MetricSet with name as prefix, instead of the whole MetricSet with name.
---