Skip to content

Statsd server gets no metric report when using spring boot metrics API and Dropwizard implementation #8254

Closed
@ZhuzhuDing

Description

@ZhuzhuDing

I'm doing it as below:

  • Use CounterService as metrics repository api just as official reference:
    @Component
    public class ComponentUseSpringBootMetrics {

	    @Autowired
	    private CounterService counterService;

	    @Scheduled(fixedRate = 5000)
	    public void increment() {
		    counterService.increment("meter.springboot.counter");
	    }
    }
  • Import Dropwizard metrics in build.gradle
buildscript {
	ext {
		springBootVersion = '1.5.1.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
	}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
	baseName = 'spring_boot_metrics_study'
	version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8

repositories {
	mavenCentral()
}

dependencies {

	compile('org.springframework.boot:spring-boot-starter-web')
	compile('org.springframework.boot:spring-boot-starter-actuator')
	
        // remove this library then it works
	compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.1.2'	
	compile group: 'com.timgroup', name: 'java-statsd-client', version: '3.1.0'
	
	testCompile('org.springframework.boot:spring-boot-starter-test')
}
  • Add statsd property in application.properties
spring.metrics.export.statsd.host=localhost

The result is statsd server won't get any report when using spring boot metrics API and Dropwizard implementation.

If I remove Dropwizard metric dependency, just use default implementation then it works.

Do I miss anything or is it a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions