addthis / metrics-reporter-config

Apache License 2.0
74 stars 52 forks source link

IllegalArgumentException: metric already exists #42

Closed gnurik closed 7 years ago

gnurik commented 7 years ago

looks like commit b8cbf4dfd96df54926d4ef731fdd8c5251eee4cb seems to cause a problem with dropwizard whose Bootstrap class does something very similar this.getMetricRegistry().register("jvm.attribute", new JvmAttributeGaugeSet()); and thus causes an exception when enableAll is called:

Exception in thread "main" java.lang.IllegalArgumentException: A metric named jvm.attribute.vendor already exists
    at com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)
    at com.codahale.metrics.MetricRegistry.registerAll(MetricRegistry.java:389)
    at com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:85)
    at com.addthis.metrics3.reporter.config.ReporterConfig.registerJvmMetrics(ReporterConfig.java:306)

Should refactor registering jvm metrics into a separate class that is not automatically called here. It also makes sense to decouple registering specific metrics from registering specific metrics reporters.

gnurik commented 7 years ago

@lucky I wrote this ticket to track the issue I raised, pls grab.

lucky commented 7 years ago

I don't think I can assign myself because I'm not a part of this org, but I'm planning to tackle this

gnurik commented 7 years ago

@lucky we're actually blocked by this issue now, can you fix plz?

gnurik commented 7 years ago

works now, thx!

lucky commented 7 years ago

Good to hear it, and sorry for the delay.