需求说明
需要在prometheus中对gateway服务进行监控,例如jvm相关指标,计划gateway服务引入spring-boot-starter-actuator和micrometer-registry-prometheus,给prometheus提供端点获取指标数据。
依赖及配置
在gateway服务添加依赖及配置:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
management:
endpoints:
web:
exposure:
include: "*"
metrics:
export:
prometheus:
enabled: true #开