1.spring boot工程引入jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
2.修改spring boot工程配置
management:
server:
port: 10091
endpoints:
web:
exposure:
include: '*'
3.启动Spring boot工程
启动后访问[http://localhost:10091/actuator](http://localhost:10091/actuator),应该能看到返回很多链接,如能看到[http://localhost:10091/actuator/prometheus](http://localhost:10091/actuator/prometheus), 说明正确。
4.转载
https://www.cnblogs.com/season2009/p/12424882.html
网友评论