|
| 1 | += Spring Boot - Actuator |
| 2 | + |
| 3 | +Spring Boot Actuator includes a number of additional features to help you monitor and |
| 4 | +manage your application when it's pushed to production. You can choose to manage and |
| 5 | +monitor your application using HTTP endpoints, with JMX or even by remote shell (SSH or |
| 6 | +Telnet). Auditing, health and metrics gathering can be automatically applied to your |
| 7 | +application. The |
| 8 | +http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready[user guide] |
| 9 | +covers the features in more detail. |
| 10 | + |
| 11 | +== Enabling the Actuator |
| 12 | +The simplest way to enable the features is to add a dependency to the |
| 13 | +`spring-boot-starter-actuator` ``Starter POM''. To add the actuator to a Maven based |
| 14 | +project, add the following "starter" dependency: |
| 15 | + |
| 16 | +[source,xml,indent=0] |
| 17 | +---- |
| 18 | + <dependencies> |
| 19 | + <dependency> |
| 20 | + <groupId>org.springframework.boot</groupId> |
| 21 | + <artifactId>spring-boot-starter-actuator</artifactId> |
| 22 | + </dependency> |
| 23 | + </dependencies> |
| 24 | +---- |
| 25 | + |
| 26 | +For Gradle, use the declaration: |
| 27 | + |
| 28 | +[indent=0] |
| 29 | +---- |
| 30 | + dependencies { |
| 31 | + compile("org.springframework.boot:spring-boot-starter-actuator") |
| 32 | + } |
| 33 | +---- |
| 34 | + |
| 35 | +== Features |
| 36 | +* **Endpoints** Actuator endpoints allow you to monitor and interact with your |
| 37 | + application. Spring Boot includes a number of built-in endpoints and you can also add |
| 38 | + your own. For example the `health` endpoint provides basic application health |
| 39 | + information. Run up a basic application and look at `/health` (and see `/mappings` for |
| 40 | + a list of other HTTP endpoints). |
| 41 | +* **Metrics** Spring Boot Actuator includes a metrics service with ``gauge'' and |
| 42 | + ``counter'' support. A ``gauge'' records a single value; and a ``counter'' records a |
| 43 | + delta (an increment or decrement). Metrics for all HTTP requests are automatically |
| 44 | + recorded, so if you hit the `metrics` endpoint should should see a sensible response. |
| 45 | +* **Audit** Spring Boot Actuator has a flexible audit framework that will publish events |
| 46 | + to an `AuditService`. Once Spring Security is in play it automatically publishes |
| 47 | + authentication events by default. This can be very useful for reporting, and also to |
| 48 | + implement a lock-out policy based on authentication failures. |
| 49 | +* **Process Monitoring** In Spring Boot Actuator you can find `ApplicationPidListener` |
| 50 | + which creates file containing application PID (by default in application directory and |
| 51 | + file name is `application.pid`). |
0 commit comments