There isn't an easy, out-of-the-box way to disable all metrics that I'm aware of.
I can see two options: 1) In the `Application.run(T, Environment)` method, you can access the `MetricRegistry` from the `Environment` parameter and could call `MetricRegistry.remove()` or `.removeMatching()` in order to remove the metrics you don't want. 2) You could set a custom `MetricRegistry` implementation on the Bootstrap object during initialization (Application.initialize(Bootstrap)) that would override the `MetricRegistry.register` method (or any other methods) with a no-op implementation. On Wednesday, December 2, 2020 at 2:09:10 AM UTC-8 [email protected] wrote: > I understand metrics is an important and significant feature of > dropwizard. However, for a memory constrained application, I would like to > be able to disable metrics entirely. I haven't found a way to do so. For > example Bootstrap registerMetrics() adds a number of default metrics, and > then starts the JmxReporter for those ones. There seem to be other metrics > registered in various places as well, which may also contribute here. > > Here are some examples (from an analyze using MAT) of what I would like to > reduce or get rid of entirely in this case: > > Class Name | Objects | Shallow > Heap > > ----------------------------------------------------------------------------- > java.util.concurrent.ConcurrentSkipListMap$Node | +2 487 | +59 > 688 > com.codahale.metrics.WeightedSnapshot$WeightedSample| +2 487 | +59 > 688 > java.lang.Double | +2 487 | +39 > 792 > java.util.concurrent.ConcurrentSkipListMap$Index | +1 261 | +30 > 264 > > ----------------------------------------------------------------------------- > > > So is there a kosher way I can use to disable ALL metrics? > > -JM > -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/120a654e-7c27-44a0-952d-51af596686c2n%40googlegroups.com.
