Search code examples
spring-bootmetricsspring-boot-actuator

Spring Boot 2.x Metrics classes


I have started using spring boot 2.0.0-Snapshot and I see that all Metric related classes and interfaces does not exists ?

Example: The jar spring-boot-actuator-2.0.0.BUILD-SNAPSHOT.jar does not have package

org.springframework.boot.actuate.metrics.writer at all

Are they moved to somewhere else?


Solution

  • In Spring Boot 2 the previous metrics implementation has been replaced by integration with Micrometer. From the release notes:

    Spring Boot’s own metrics have been replaced with support, including auto-configuration, for Micrometer and dimensional metrics. You can learn more about Micrometer in its user manual and Spring Boot’s reference guide

    I can't find any guide for migrating from 1.x Spring Boot Metrics to 2.x Spring Boot Metrics but this change is quite recent so I suspect any such docs are a TODO. In the meantime, you could perhaps dig into the Pull Request or follow the Spring Boot 2 docs ...

    Micrometer provides a separate module for each supported monitoring system. Depending on one (or more) of these modules is sufficient to get started with Micrometer in your Spring Boot application. To learn more about Micrometer’s capabilities, please refer to its reference documentation.