springspring-bootspring-boot-actuator

How to disable metrics in Spring-Boot?


I use DropWizard to collect my own metrics for endpoints. I like my solution since I can add my own dimensions to it as I wish.

Apart from this Spring automatically collects and adds additional metric data to Dropwizard which I don't need. How to disable metrics in Spring-Boot to disable this?

I have found MetricsDropwizardAutoConfiguration.class, and DropwizardMetricServices.class but none seem to have a property or config to turn them off.

So my next thought was to turn off Spring-Boot-Actuator's metrics. I found these application.properties, while debugging, but these did not turn off the metric logging:

endpoints:
  metrics:
    enabled: false
management.endpoints.metrics.enabled: false
spring:
  metrics:
    export:
      enabled: false

EDIT

springBootVersion = '1.5.9.RELEASE'


Solution

  • My solution was to disable the auto-configuration: MetricsDropwizardAutoConfiguration.class using @SpringBootApplication(exclude = {MetricsDropwizardAutoConfiguration.class}). This way I had to introduce my own MetricRegistry @Bean.