Spring Boot 2 执行器千分尺设置
Spring Boot 2 Actuator Micrometer setup
我有一个 Spring 启动应用程序并且我有这个依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.7.RELEASE</version> // From Parent
</dependency>
我还配置了我的 application.yml
文件以公开指标:
management:
endpoints:
web:
exposure:
include: info, health, metrics
我还为 Kafka 创建了一个 Metrics bean:
@Bean
public KafkaConsumerMetrics kafkaConsumerMetrics() {
return new KafkaConsumerMetrics();
}
但是当我到达终点 GET http://localhost:8080/actuator/metrics
时,我得到一个 404 Page Not Found
错误。
其他端点 (info/health) 有效:http://localhost:8080/actuator/info and http://localhost:8080/actuator/health
获取千分尺数据我缺少什么?
您可以尝试从配置中启用指标,但它应该默认启用
management:
endpoint:
metrics:
enabled: true
有关执行器属性的更多详细信息https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#actuator-properties
我有一个 Spring 启动应用程序并且我有这个依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.7.RELEASE</version> // From Parent
</dependency>
我还配置了我的 application.yml
文件以公开指标:
management:
endpoints:
web:
exposure:
include: info, health, metrics
我还为 Kafka 创建了一个 Metrics bean:
@Bean
public KafkaConsumerMetrics kafkaConsumerMetrics() {
return new KafkaConsumerMetrics();
}
但是当我到达终点 GET http://localhost:8080/actuator/metrics
时,我得到一个 404 Page Not Found
错误。
其他端点 (info/health) 有效:http://localhost:8080/actuator/info and http://localhost:8080/actuator/health
获取千分尺数据我缺少什么?
您可以尝试从配置中启用指标,但它应该默认启用
management:
endpoint:
metrics:
enabled: true
有关执行器属性的更多详细信息https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#actuator-properties