prometheus.yml/yaml 新增job
- job_name: 'springboot'
metrics_path: '/actuator/prometheus'
static_configs:
- targets:
- 'ip:port'
labels:
instance: 'instanceName'
pom文件引包
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>-->
<groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-starter-actuator</artifactId>-->
</dependency>-->
application.yaml 配置
#prometheus配置
management:
endpoints:
web:
exposure:
include: 'prometheus'
metrics:
tags:
application: ${spring.application.name}
## 重启promethues
网友评论