How to add custom attributes to JMX Metric MBean?

887 views
Skip to first unread message

Nikolay Karasev

unread,
Mar 12, 2015, 3:01:17 PM3/12/15
to dropwiz...@googlegroups.com
Hi,

we are using dropwizard metric component to generate metrics for our application. We have a requirement to add some attributes to the MBeans, this is what it would look like:

name="com.my.domain:name=my.bean.name,type=myBeanType" if we were to create actual MBean objects.

When working with dropwizard/codahale metric we would typically register new MBean by invoking something like metricRegistry.meter("my.bean.name") where registry is created using domain "com.my.domain".
How do we add additional attributes, in our example it would be "type=myBeanType"?

Thanks,
Nikolay

steve christensen

unread,
Mar 12, 2015, 4:00:49 PM3/12/15
to dropwiz...@googlegroups.com
Looks like the ObjectName is assigned in metrics' JmxReporter.java (JmxListener.createName()), it doesn't appear that beyond the domain name and name key that it's configurable. I assume that's by design to have a simple present name:metric to reporter implementations.



If you want an easy way to expose your POJOs as MBeans, you might have better luck with one of the following:

Nikolay Karasev

unread,
Mar 12, 2015, 4:21:59 PM3/12/15
to dropwiz...@googlegroups.com
It would be unfortunate if I could not expose additional attribute since I otherwise like the features that are offered by codahale metrics. We also have bunch of code already configured and working with that component, so we will stay with it.

Are there developers that might address this in the future?

Thanks,
Nikolay

Bharadwaj Narasimha

unread,
Mar 6, 2016, 3:27:42 AM3/6/16
to dropwizard-user
+1 for this feature request

Bharath
Reply all
Reply to author
Forward
0 new messages