Monday, 5 March 2018

What is use of Actuators for Spring application ?


Actuators are used to get important indicators and stats of the Spring application.
It exposes many paths, which are displayed on application start logs.

Just add dependency in pom.xml and on the application startup you will get all the available actuator URLs in the logs.

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency> 


You can see indicators in JSON format by using different paths / URLs : 
  • /beans : Displays a complete list of all the Spring beans in your application
    • All the loaded beans can be seen in application startup logs
  • /health : Shows application health information
  • /machine : Shows machine health information
  • /info : Displays arbitrary application information
  • /loggers : Shows and modifies the configuration of loggers in the application
  • /metrics : Shows 'metrics' information for the current application (like, No. of hits)
  • /mappings : Displays a collated list of all @RequestMapping paths (Exposed APIs)
  • /scheduledtasks : Displays the scheduled tasks in your application
  • /threaddump : Performs a thread dump
  • /trace : Request information, Properties from application.properties
  • /shutdown : Lets the application be gracefully shutdown
EXAMPLES
http://localhost:8080/health http://localhost:8080/loggers


No comments:

Post a Comment

Note: only a member of this blog may post a comment.