Hardik Doshi
Hardik Doshi

Reputation: 3

Dropwizard MetricRegistry with Spring Boot 2

I was upgrading spring boot to 2 in one of the project. I am facing issue with @Autowire metricRegistry:MetricRegistry

I had read upgrade guide where it is mentioned that Metrics are replaced by Micrometer's MeterRegistry.

Since, Dropwizard MetricRegistry is havely used in current project, it is difficult to replace it.

Is there any possibility to use Dropwizard MetricRegistry with spring boot 2 and @Autowire metricRegistry:MetricRegistry get work?

Upvotes: 0

Views: 426

Answers (1)

Jonatan Ivanov
Jonatan Ivanov

Reputation: 6921

Fyi: Spring Boot 2 reached its end of OSS support life a while ago, you should upgrade to the latest 3.x: https://spring.io/projects/spring-boot#support

You should take a look at DropwizardMeterRegistry, you can use it as:

@Bean
DropwizardMeterRegistry dropwizardMeterRegistry(...) {
    return new DropwizardMeterRegistry();
}

Then you can inject MeterRegistry (Micrometer's API) in new code and keep using MetricsRegistry (Dropwizard's API) in old code.

Upvotes: 0

Related Questions