Kafka 0.8.2-beta consumer, 0.8.1 broker.
In our consumer, we retrieve the mbeans
"kafka.server":name="*-ConsumerLag",type="FetcherLagMetrics" in order to send
partition lag data to our monitoring service. The underlying metrics object is
a Gauge[Long], but the "Value" attribute returned by JMX for this mbean is a
java.lang.Object.
For example:
import java.lang.management._
import javax.management._
val mbs = ManagementFactory.getPlatformMBeanServer
val beanNames = mbs.queryNames(new
ObjectName("\"kafka.server\":type=\"FetcherLagMetrics\",name=\"*-ConsumerLag\""),
null)
for (b <- beanNames) println(mbs.getMBeanInfo(b))
generates the output:
javax.management.MBeanInfo[attributes=[javax.management.MBeanAttributeInfo[name=Value,
type=java.lang.Object, read-only, descriptor={}]],
descriptor={immutableInfo=true,
interfaceClassName=com.yammer.metrics.reporting.JmxReporter$GaugeMBean,
mxbean=false}]
We can work around this by using asInstanceOf[Long], but that usually indicates
we're doing something wrong.
Am I missing something here? I would expect types like Scala Long to be
preserved across JMX.
--
Jack Foy <[email protected]<mailto:[email protected]>>