Use Layotto Actuator for health check and metadata query
This example shows how to perform health check and metadata query through Layotto Actuator's Http API
What is Layotto Actuator
In the production environment, the status of the application needs to be monitored, and Layotto has built-in a monitoring function, which is called Actuator.
Using Layotto Actuator can help you monitor and manage Layotto and the applications behind Layotto, such as health checks, query runtime metadata, etc.
All these features can be accessed through the HTTP API.
Quick start
Run Layotto server
After downloading the project source code, change directory and compile:
cd ${project_path}/cmd/layotto
go build
After completion, the layotto file will be generated in the directory, run it:
./layotto start -c ../../configs/config_standalone.json
Q: The demo report an error?
A: With the default configuration, Layotto will connect to apollo's demo server, but the configuration in that demo server may be modified by others. So the error may be because some configuration has been modified.
In this case, you can try other demos.
Access the health check API
Visit /actuator/health/liveness
curl http://127.0.0.1:34999/actuator/health/liveness
return:
{
"components": {
"apollo": {
"status": "UP"
},
"runtime_startup": {
"status": "UP",
"details": {
"reason": ""
}
}
},
"status": "UP"
}
In the above json,"status": "UP" means the status is healthy. The Http status code returned is 200.
If the current state is unhealthy, the value of "status" will be "DOWN", and the Http status code returned will be 503.