无法在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"
}
请告诉我为什么我没有获得普罗米修斯指标?
你增加micrometer-registry-prometheus
了你的依赖吗?
千分尺具有可插拔的体系结构,您需要在其中定义(通过插入依赖项)您要使用的监视系统。(您甚至可以添加多个,而不仅仅是一个。)
顺便说一句,您应该切换到Spring Boot 2.0.0.RC1
。这是撰写本文时的最新内容。
是的,我添加了
micrometer-registry-prometheus
依赖性,但是并不能解决我的问题。在找到的文档中endpoints.prometheus.id: micrometheus
,但是在application.yaml中却没有。@makson您正在使用什么“网络”技术?当我进行测试时,
spring-boot-starter-web
它可以与2.0.0.M7
一起使用2.0.0.RC1
。但是当我用spring-boot-starter-jersey
404 测试时会吐出来。执行器端点未注册。您需要ResourceConfig
在上下文中添加/注册BeanJerseyAutoConfiguration
才能启动。我正在使用
RouterFunctions
和spring-boot-starter-webflux
。更新弹簧后,2.0.0.RC1
所有工作即可。谢谢。