enable JmxReporter configuratively

15 views
Skip to first unread message

Fabio Hecht

unread,
Jan 15, 2019, 6:45:06 AM1/15/19
to metrics-user
Dear metrics users,

I'm trying to enable instrumenting log4j and exposing the metrics via JMX without rebuilding upstream projects. The example at https://metrics.dropwizard.io/4.0.5/manual/log4j.html helped me enable the metrics via log4j2.xml.

Is it possible to start the JmxReporter via configuration only (e.g. config file, parameter, or environment variable)?

Cheers,

Fabio


Rich MacDonald

unread,
Jan 29, 2019, 3:21:45 PM1/29/19
to metrics-user
Trivial to roll your own. Just create your own configuration variables in a properties files (or context.xml, etc) and build JmxReporter yourself from them. Look at the class com.codahale.metrics.JmxReporter.Builder.

I have a production app with configuration files for csv, jmx, graphite and cloudwatch targets, with different filters and groupings of jvm, servlet, ehcache, and the hikari connection pool. The production app checks for updates to these properties and reconfigures itself if they change. When you change properties, you'll need to close the existing jmxReporter instance then create and start a new instance.
Reply all
Reply to author
Forward
0 new messages