- SpringBoot 版本
- 2.3.1.RELEASE
- micrometer-registry-prometheus 版本
- 1.6.6
SpringBoot 项目配置
SpringBoot配置文件里面添加<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus --><dependency><groupId>io.micrometer</groupId><artifactId>micrometer-registry-prometheus</artifactId><version>1.6.6</version></dependency>
重新启动 SpringBoot 项目。# prometheus metricmanagement:endpoints:web:exposure:include: "prometheus"metrics:export:datadog:host-tag: "springboot-application"
- 1.6.6
Prometheus 配置
vim prometheus.yml 新增如下配置, ip 和 port 填写自己的web服务地址和端口
- job_name: "springboot-application"# 采集数据时间间隔scrape_interval: 15s# 采集超时时间scrape_timeout: 10s# 采集路径metrics_path: '/actuator/prometheus'# 采集服务地址static_configs:- targets: ['ip:port']
Grafana 配置
Grafana 配置文件 https://grafana.com/grafana/dashboards/4701
参考
https://blog.csdn.net/Goodbye_Youth/article/details/105575954
https://blog.csdn.net/weixin_48182198/article/details/114491254
