我的团队将我们的微服务从 Spring Boot 1 迁移到了版本 2,并且由于执行器发生了变化,我们通过 prometheus jmx 导出器导出的 Health Endpoint Metrics 不再起作用。
通常的 /actuator/health 按预期工作,但prometheus-jmx-exporter不会拿起它,尽管尝试了几件事:
- 我更改了 exporter-config.yaml 中的元信息以反映 Spring Boot 2 中的名称更改
- 我将 io.micrometer:micrometer-registry-prometheus 添加到我们的 build.gradle 中,看看这是否是问题所在
- 我根据 Spring Boot 2 文档公开了 web 和 jmx 端点
所以现在我的想法已经用完了,如果oyu能给我任何提示,我将不胜感激
旧的 prometheus-jmx-exporter exporter-config.yaml:
---
lowercaseOutputName: true
lowercaseOutputLabelNames: true
whitelistObjectNames: ["org.springframework.boot:type=Endpoint,name=healthEndpoint"]
rules:
- pattern: 'org.springframework.boot<type=Endpoint, name=healthEndpoint><(.*, )?(.*)>(.*):'
name: health_endpoint_$1$3
attrNameSnakeCase: true
新的 prometheus-jmx-exporter exporter-config.yaml:
---
lowercaseOutputName: true
lowercaseOutputLabelNames: true
whitelistObjectNames: ["org.springframework.boot:type=Endpoint,name=Health"]
rules:
- pattern: 'org.springframework.boot<type=Endpoint, name=Health>'
name: health_endpoint_$1$3
attrNameSnakeCase: true
当前关于执行器端点的应用程序属性:
management.endpoints.web.exposure.include=info, health, refresh, metrics, prometheus
management.endpoints.jmx.exposure.include=health, metrics, prometheus
在带有旧 exporter-config.yaml 的 Spring Boot 1 中,我得到如下结果:
# HELP health_endpoint_hystrix_status Invoke the underlying endpoint (org.springframework.boot<type=Endpoint, name=healthEndpoint><hystrix, status>status)
# TYPE health_endpoint_hystrix_status untyped
health_endpoint_hystrix_status 1.0
# HELP health_endpoint_status Invoke the underlying endpoint (org.springframework.boot<type=Endpoint, name=healthEndpoint><status>status)
# TYPE health_endpoint_status untyped
health_endpoint_status 1.0
但是随着所有的变化和 Spring Boot 2 中的变化,我什么也没得到。