we are trying to healthcheck a spring boot application, we are planning to use spring boot actuator health to get the health status.
what is confusing is which classes provide the default healthcheck status ({"status":"UP"}) when CassandraHealthIndicator, DiskSpaceHealthIndicator, DataSourceHealthIndicator, ElasticsearchHealthIndicator, JmsHealthIndicator, MailHealthIndicator, MongoHealthIndicator, RabbitHealthIndicator, RedisHealthIndicator, SolrHealthIndicator are not applicable.
I believe the default is ApplicationHealthIndicator but you can of course write your own:
public class CustomHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
private int check() {
return 0;
}
}
Found the answer after tracing the health request. Default Health information is derived from DiskSpaceHealthIndicator
, the request for health is handled from HealthMvcEndpoint
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.