配置Prometheus及健康检测
# 1 添加POM依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 2 配置开放健康监测端点
management.endpoints.web.exposure.include = *
management.endpoints.web.exposure.exclude = shutdown
management.endpoint.health.show-details = always
1
2
3
2
3
# 3 测试健康检测是否配置成功
访问监测端点
http://{host}:{port}/{context-path}/actuator/prometheus
1
提示
context-path 即应用配置文件中配置的 server.servlet.context-path
返回页面出现以下内容即代表配置成功
上次更新: 2022/11/24, 17:59:25