【发布时间】:2022-01-06 05:33:06
【问题描述】:
我想展示一些使用千分尺 prometheus 和 spring-boot-actuator 的指标。我的项目完全基于 spring-boot 并启用了执行器功能并映射到以下 url:http://localhost:9000/actuator 其他端点显示正确,但 http://localhost:9000/actuator/prometheus 没有。您可以在下面找到我在访问此 http-endpoint 时获得的屏幕截图。
有人可以帮我吗?为什么会发生这种情况,我该如何解决? 原因通常当您提供合适的依赖项时,prometheus 会自动为 spring-boot-actuator 配置。
【问题讨论】:
-
尝试使用
--debug标志(或-Ddebug)运行您的应用程序。从给定的信息来看,似乎一些自动配置没有完成。启用调试会告诉您确切的原因(缺少依赖项、错误配置的属性等)。 -
感谢您的回复,但它没有注销任何有用的东西,只是启动应用程序时的正常内容,还有其他想法吗?
-
你能用 prometheus 的配置更新你的问题吗?确保 metrics_path 配置正确,例如 metrics_path: '/actuator/prometheus'
-
prometheus 配置?这是必要的吗?因为我认为默认配置了 /actuator/prometheus 你能提供一个示例配置吗?会很有帮助=)
标签: spring spring-boot prometheus spring-boot-actuator micrometer