我已经配置了一个可以在我的代码中运行的数据源,但是我无法在Actuator / metrics端点上报告指标。
我的设置如下:
它确实出现在/荒地上。 我在/ configprops端点上注意到以下内容,我猜是问题...虽然我不知道如何处理它:
"spring.datasource.CONFIGURATION_PROPERTIES": {
"prefix": "spring.datasource",
"properties": {
"error": "Cannot serialize 'spring.datasource'"
}
},
就像我说的那样,快乐" on / 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
答案 0 :(得分:2)
Spring Boot仅为以下类型的DataSource
提供开箱即用的指标:
com.zaxxer.hikari.HikariDataSource
org.apache.commons.dbcp.BasicDataSource
org.apache.commons.dbcp2.BasicDataSource
org.apache.tomcat.jdbc.pool.DataSource
要获取JBoss数据源的指标,您需要提供一个DataSourcePoolMetadataProvider
bean,它返回一个特定于JBoss DataSourcePoolMetaData
实现的DataSource
实现。