Dropwizard JmxReporter sends gauge metrics as java.lang.Object instead of numerc type

92 views
Skip to first unread message

Hans Holzbart

unread,
Dec 6, 2016, 3:50:38 AM12/6/16
to metrics-user
I use dropwizard and JMX to report some metrics to our monitoring service (introscope). The underlying metrics object is a Double, 
but the "Value" attribute showed by Java Monitoring & Management Console for this bean is a java.lang.Object. Introscope needs numeric values 
in order to build a graph an cannot do that with java.lang.Object.

Is there a way to let dropwizard send values as Doubles?


pom.xml

<properties>
 <metrics.core.version>3.1.2</metrics.core.version>
  <hystrix.codahale.metrics.publisher.version>1.5.6</hystrix.codahale.metrics.publisher.version>
</properties>

<dependency>
 
<groupId>io.dropwizard.metrics</groupId>
 
<artifactId>metrics-core</artifactId>
 
<version>${metrics.core.version}</version>
</dependency>
<dependency>
 
<groupId>com.netflix.hystrix</groupId>
 
<artifactId>hystrix-codahale-metrics-publisher</artifactId>
 
<version>${hystrix.codahale.metrics.publisher.version}</version>
 
<exclusions>
   
<exclusion>
      <groupId>com.codahale.metrics</groupId>
      <artifactId>metrics-core</artifactId>
    </exclusion>
 
</exclusions>
</dependency>



ReportsConfig.java

import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;

@Configuration
public class ReportsConfig {

 
@Bean
 
public MetricRegistry metricRegistry() {
   
return new MetricRegistry();
 
}
 
 
@Bean
 
public JmxReporter jmxReporter(final MetricRegistry metricRegistry) {
   
JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).build();
    reporter
.start();
   
return reporter;
 
}
}

Reply all
Reply to author
Forward
0 new messages