我配置了一个在我的代码中工作的数据源,但我无法让它报告 Actuator /metrics 端点上的指标。
我的设置如下:
- 春季启动 1.3.3
- JBoss EAP 6.4 JBoss 中定义的 JNDI 数据源
- 在 application.properties 中为 Spring Boot 配置的 JNDI 数据源
- 甲骨文数据库
它确实出现在 /heath 上。我在 /configprops 端点上注意到以下内容,我猜这是问题所在……尽管我不确定该怎么做:
"spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"error": "Cannot serialize 'spring.datasource'"
}
},
就像我说的,它在 /health 上是“快乐的”:
{
"status": "UP",
"customHealthCheck": {
"status": "UP"
},
"jms": {
"status": "UP",
"provider": "HornetQ"
},
"diskSpace": {
"status": "UP",
"total": 499055067136,
"free": 285583982592,
"threshold": 10485760
},
"db": {
"status": "UP",
"database": "Oracle",
"hello": "Hello"
}
}
这是我的 application.properties,如果有帮助的话。
server.servlet-path=/*
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.jndi-name=java:jboss/yourfriendthedatabase-ds
spring.datasource.validation-query=SELECT 1 FROM DUAL
# escapes reserved words used as column names (if any)
spring.jpa.properties.globally_quoted_identifiers=true
spring.jpa.properties.show-sql=true
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
management.security.enabled=false
management.health.db.enabled=true
management.health.diskspace.enabled=true
endpoints.health.enabled=true
endpoints.health.sensitive=false
endpoints.metrics.sensitive=false