Spring Boot+Prometheus+Grafana监控配置
1. Spring Boot配置
pom文件导入prometheus依赖
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.0.11</version>
</dependency>
spring boot配置文件添加如下内容
spring:
application:
name: boot
#监控
management:
endpoints:
web:
exposure:
include: prometheus
base-path: /actuator
endpoint:
health:
show-details: always
metrics:
tags:
application: ${spring.application.name}
server:
port: 9527
创建配置类Metrics
/**
* @author huangkaiqiang
* @version 1.0
* @description
* @date 2020/12/18 18:01
*/
@Configuration
public class MetricsConfig {
@Value("${spring.application.name}&#