【发布时间】:2019-12-18 12:54:49
【问题描述】:
我已将我的 Spring Boot 应用程序升级到最新的 2.2.2 Boot 版本。从那以后,我只有一个指标端点,但没有 Prometheus。
我的 build.gradle.kts 文件具有 org.springframework.boot:spring-boot-starter-actuator 作为依赖项,我还添加了 io.micrometer:micrometer-registry-prometheus 作为参考建议 (Prometheus endpoint)。
我的 application.yml 如下所示:
management:
server:
port: 9000
endpoints:
web:
exposure:
include: health, shutdown, prometheus
endpoint:
shutdown:
enabled: true
谁能指引我正确的方向?
编辑:它在 Spring Boot 2.2.0 中工作。这是下载相同项目的链接:link
编辑 2:我可以验证它是否也适用于 2.2.1。
【问题讨论】:
-
嗯,这很奇怪。我有相同的设置,它工作得很好。
-
@jirka.pinkas 你确定吗?我刚刚又下载了一个新项目,结果一样:start.spring.io/… 并添加
implementation("io.micrometer:micrometer-registry-prometheus") -
只有两个区别:1. 我使用 Maven,2. 我的 application.properties 中有:management.endpoints.web.exposure.include=* 我的依赖项:actuator & micrometer-registry-prometheus & spring-boot-starter-web。编辑:刚刚用新项目(在start.spring.io上创建)对其进行了测试,它可以工作。 EDIT2:即使使用 management.endpoints.web.exposure.include=health,shutdown,prometheus 它也可以工作
-
也许发现了你的问题:你使用的是 webflux,而不是 web。似乎它不适用于 webflux(目前):stackoverflow.com/questions/48603285/…
-
@jirka.pinkas 它应该可以工作,我一直在将它与 WebFlux + Spring Boot 2.2.0 一起使用,没有任何问题。 :(
标签: spring-boot prometheus spring-boot-actuator