I have successfully integrated actuators in spring boot application and when i use mentioned curl to check health status,I always gets {"status":"UP"}.
curl --location --request GET http://localhost:8080/endpoints/health
Now I am wondering that which all endpoits it hits to check service health?
CodePudding user response:
Health check functions tell us the status of our running application like whether the service is slow or not available.
We also learn to predict the system's health in the future by observing any anomalies in a series of metrics like memory utilization, errors, and disk space. This allows us to take mitigating actions like restarting instances, falling back to a redundant instance, or throttling the incoming requests.
You can see more info on the metrics here enter link description here
CodePudding user response:
It integrates health indicators in the application context and shows by default, a single answer: UP or DOWN.
For example, DataSourceHealthIndicator, DiskSpaceHealthIndicator, MongoHealthIndicator, etc are among the health indicators. You can define your own custom health checking or disable an indicator in the properties file. Like this:
management.health.mongo.enabled=false
Also, you can set to see the details of the health check in this way:
# HEALTH ENDPOINT
management.endpoint.health.show-details=always
And it is a sample of an output of a system using MySQL which is down:
{
"status":"DOWN",
"details":{
"db":{
"status":"DOWN",
"details":{
"error":"org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30006ms."
}
},
"diskSpace":{
"status":"UP",
"details":{
"total":250790436864,
"free":100324585472,
"threshold":10485760
}
}
}
}
See here for more details: https://www.callicoder.com/spring-boot-actuator/