Reputation: 441
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.
Upvotes: 0
Views: 1220
Reputation: 441
Found the answer after tracing the health request. Default Health information is derived from DiskSpaceHealthIndicator
, the request for health is handled from HealthMvcEndpoint
Upvotes: -1
Reputation: 943
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;
}
}
Upvotes: 2