Spring Actuator

Spring Actuator란

Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production. You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application.

Spring Boot에는 프로덕션에 푸시 할 때 응용 프로그램을 모니터링하고 관리하는 데 도움이되는 여러 가지 추가 기능이 포함되어 있습니다. HTTP 엔드포인트 또는 JMX를 사용하여 애플리케이션을 관리하고 모니터링하도록 선택할 수 있습니다. 감사, 상태 및 메트릭 수집도 응용 프로그램에 자동으로 적용될 수 있습니다.

https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/production-ready.html

Spring Actuator를 설정하면 Spring Boot Dashboard에서 Spring Boot Application에 대한 각종 상태 확인이 가능하다. 프로젝트는 Redirect 에서 만든 프로젝트를 사용한다.

의존성 추가

의존성 추가는 pom.xml에 직접 하거나 Add starters 메뉴를 사용한다.

pom.xml

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

Add Starters

프로젝트 우클릭 후 Spring → Add Starters 메뉴에서 Spring Boot Actuator를 선택한다. 파일 선택창이 나오면 pom.xml을 선택하고 확인을 누른다.

pom.xml에 의존성이 추가된 것을 확인할 수 있다.

Actuator 활성화 설정

의존성을 추가했으면 Actuator를 사용할 수 있도록 설정해야 한다. 설정이 이루어지지 않은 경우 Boot Dashboard에서 Show Properties 메뉴를 누르면 다음과 같이 메세지가 나온다.

프로젝트가 실행중이어야 한다.

요구하는대로 mappings, beans, env에 대한 Actuator 설정을 확인할 수 있도록 application.properties에 다음과 같이 설정한다.

management.endpoints.web.exposure.include=mappings,beans,env

Boot Dashboard 확인

프로젝트를 재시작한 뒤 적용된 프로젝트에서 Show Properties 메뉴를 누르면 분석 가능한 요소들이 표시되는 것을 확인할 수 있다.

Last updated