mak*_*son 3 metrics spring-boot prometheus
在spring boot 2(版本2.0.0.M7)项目中不能包含Prometheus指标.
据微米文档添加弹簧引导起动器的依赖,并在application.yaml加入management.endpoints.web.expose:普罗米修斯,但是打电话时/执行器/普罗米修斯 GET
{
"timestamp": 1518159066052,
"path": "/actuator/prometheus",
"message": "Response status 404 with reason \"No matching handler\"",
"status": 404,
"error": "Not Found"
}
请告诉我为什么我没有获得prometheus指标?
小智 10
我在使用 Springboot 2.x 启动千分尺时遇到了麻烦。
我的项目中的这些更改帮助我在actuator/prometheus 端点公开指标
这些是我的application.properties文件 中的更改
management.endpoints.web.exposure.include=*
management.endpoint.metrics.enabled=true
Run Code Online (Sandbox Code Playgroud)
我的build.gradle文件包括
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('io.micrometer:micrometer-registry-prometheus')
Run Code Online (Sandbox Code Playgroud)
如果以上解决方案对某人不起作用,请尝试以下方法:我遇到了与Spring Boot 2.0.0.RC1,spring-boot-starter-web以及spring-boot-starter-actuator相同的问题.
我的application.properties文件读取:
management.endpoints.web.expose=prometheus,metrics,info,health
Run Code Online (Sandbox Code Playgroud)
在我的pom文件中,我还有:
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>0.12.0.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
/ actuator/prometheus下的Prometheus指标,只有在我切换到千分尺 - 注册表 - prometheus的最新版本后才显示:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.0.0-rc.9</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
你添加micrometer-registry-prometheus到你的依赖项了吗?
Micrometer 具有可插拔架构,您需要在其中定义(通过插入依赖项)您想要使用的监控系统。(您甚至可以添加多个,而不仅仅是一个。)
顺便说一句,您应该切换到 Spring Boot 2.0.0.RC1。这是撰写本文时的当前状态。
| 归档时间: |
|
| 查看次数: |
5989 次 |
| 最近记录: |