我通过以下方式在 Spring Boot 应用程序中添加了 prometheus 依赖项。
我在gradle中添加了以下依赖
runtimeOnly ('io.micrometer:micrometer-registry-prometheus')
runtimeOnly ('io.micrometer:micrometer-core')
应用程序.yml
management:
endpoints.web.exposure.include: '*'
endpoint.metrics.enabled: true
endpoint.prometheus.enabled: true
metrics.export.prometheus.enabled: true
server.servlet.context-path: /route
部署文件中的注释 部署.yml
annotations:
prometheus.io/scrape: "true"
prometheus.io/probe: "true"
prometheus.io/port: "8010"
prometheus.io/path: "/actuator/prometheus"
部署后 /actuator/prometheus 端点未公开,但在 localhost 中已公开 我应该改变什么才能使它工作