发布时间: 2024-11-28 文章作者: myluzh 分类名称: Kubernetes 朗读文章
<!-- Micrometer Prometheus registry --> <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> <!-- finished -->2、修改java项目 src/main/resources/application.yml
management: metrics: tags: application: "${spring.application.name}"3、打包后上线应用,测试应用是否暴露了metrics接口
[root@centos-test-5b7765fcbd-76vzc /]# curl svc-dxp-api.dev-test.svc.cluster.local:9208/actuator/prometheus # HELP jdbc_connections_min Minimum number of idle connections in the pool. # TYPE jdbc_connections_min gauge jdbc_connections_min{application="xfshcloud-dxp",name="DB1",} 1.0 ...0x02 prometheus 采集数据
- job_name: 'jvm-prometheus' scheme: http metrics_path: '/actuator/prometheus' static_configs: - targets: ['svc-dxp-api.dev-test.svc.cluster.local:9208']0x03 添加 grafana 面板
标签: java Prometheus jvm micrometer
发表评论