Spring boot actuator + prometheus 연동

bbbbbhyun·2024년 10월 24일
0

1. 의존성 주입

  • maven version
<!-- actuator-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- prometheus -->
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
  • gradle version
<!-- actuator-->
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
<!-- prometheus -->
implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus'

2. properties 설정 추가

# Actuator setting sample
# 1. Endpoint all disable
management.endpoints.enabled-by-default = false
# 2. Enable specific endpoints
management.endpoint.info.enabled = true
management.endpoint.health.enabled = true
# 3. Exclude all endpoint for JMX and Expose specific endpoints
management.endpoints.jmx.exposure.exclude = *
management.endpoints.jmx.exposure.include = info, health, metrics, prometheus
management.endpoints.web.exposure.include = info, health, metrics, prometheus
# 4. Use other port for Actuator
management.server.port = 8080
# 5. Change Actuator Default path
management.endpoints.web.base-path = /test
# 6.
management.endpoint.health.show-details = always
# 7.
management.endpoint.prometheus.enabled=true
profile
BackEnd develope

0개의 댓글