Spring 启动 2.x 指标 类

Spring Boot 2.x Metrics classes

我已经开始使用 spring boot 2.0.0-Snapshot,我发现所有与指标相关的 类 和接口都不存在?

示例: jar spring-boot-actuator-2.0.0.BUILD-SNAPSHOT.jar 没有包

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

他们搬到别的地方了吗?

在 Spring Boot 2 中,之前的指标实现已被与 Micrometer 的集成所取代。来自发行说明:

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

我找不到任何关于从 1.x Spring 引导指标迁移到 2.x Spring 引导指标的指南,但这个变化是最近发生的,所以我怀疑任何这样的文档是一个 TODO。与此同时,您也许可以深入研究 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.