Monday, April 12, 2021

Spring Boot Actuator

In this post, we will expose Spring Boot actuator in our previous gateway-server project. There are many endpoint actuator that is useful to monitor our microsevices, some of them are info and health. To enable actuator, we need to add the following dependency on our pom.xml.


The complete dependency in our pom.xml now looks like this.


Next in the application.properties we need to include exposed actuator endpoint. Here we include hystrix.stream, info, and health. As for actuator info, we add some custom information which are started with info key. And for actuator health, we will display a complete detail of information of the service using management.endpoint.health.show-details.


Let's now start the eureka-server, config-server, and gateway-server application. Once started, we can check the actuator info in browser as shown below.


Next point out to actuator health as shown below. Here we can confirm that the service status is UP. It also displays some other component information.


Lastly, we expose hystrix stream as shown below. However, one more step is needed by adding @EnableHystrix in Spring Boot application. This hystrix stream will be used by hystrix dashboard which we'll see on another post.



As a reference on actuator, this Spring documentation is a useful resource.

0 comments:

 

©2009 Stay the Same | by TNB