Video in progress

What is Spring Boot Actuator and what does it give you?

Actuator is a module that adds ready-made management endpoints to a Spring Boot application: health, metrics, info, loggers, env and others. Through them you check the application's state from outside and connect it to a monitoring system.

📖 Answer

Adding it is a single dependency:

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

After that, /actuator/health works right away. There are other endpoints, but over HTTP only health is exposed by default, for security. You open the ones you need yourself:

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus

The most used ones:

  • health: whether the application and the things it depends on (DB, Redis, disk) are working;
  • metrics: the list of Micrometer metrics;
  • prometheus: metrics in the format Prometheus reads (needs micrometer-registry-prometheus);
  • loggers: change the log level without a restart;
  • info: version, git commit.

env, heapdump, threaddump and the like expose internal data, so don't leave them open to the internet.