ROC*_*CKY 6 spring spring-boot spring-boot-actuator spring-webflux
我按照此处的文档(https://docs.spring.io/spring-boot/docs/2.0.0.RC1/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints)进行操作,并确保application.yml文件具有以下
management:
metrics:
export:
prometheus:
enabled: true
endpoints:
web:
expose:
health, info, httptrace, metrics, threaddump, mappings, prometheus
Run Code Online (Sandbox Code Playgroud)
根据文档(https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/actuator-api/html/#prometheus),以下操作无效。
curl 'http://localhost:8080/actuator/prometheus' -i
Run Code Online (Sandbox Code Playgroud)
我得到404处理程序映射未找到异常。有人可以让我知道如何启用Prometheus端点进行抓取,以及需要使用哪个URL端点进行测试吗?
o.s.w.r.r.m.a.RequestMappingHandlerMapping[276] - Did not find handler method for [/actuator/prometheus]
Run Code Online (Sandbox Code Playgroud)
所有其他端点的运行状况,信息,httptrace,线程转储,映射均正常运行。
有点晚了-但仅作记录-我可以在2.0.0.RELEASE中验证它现在可以正常工作。
依赖关系(等级):
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)
application.yaml(参考)
management:
endpoints:
web:
exposure:
include: health,info,prometheus
Run Code Online (Sandbox Code Playgroud)
我还使用RC1进行了测试-普罗米修斯端点由于某种原因未显示-就像@ROCKY解释的那样。
您可以检查一些事情:
您是否添加了必要的MeterRegistry实现,以便使Micrometer仪器库的Prometheus“子系统” 存在?(从Spring Boot 2.0开始,Micrometer库为Actuator实现提供了动力)
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
如果没有特定的MeterRegistry实现,则最终只能/actuator/metrics得到SimpleMeterRegistry实现支持的常规终结点。
您是否实际将提到的属性放在application.[yml,yaml]文件中而不是application.properties?(我只是偶然发现了一个由Spring Initializr生成的新演示项目)。
| 归档时间: |
|
| 查看次数: |
5808 次 |
| 最近记录: |