From 161425157f343223b7d78844a7f399ec885d3a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Sat, 21 Mar 2026 18:00:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=EB=A9=94=ED=85=8C?= =?UTF-8?q?=EC=9A=B0=EC=8A=A4,=20=EA=B7=B8=EB=9D=BC=ED=8C=8C=EB=82=98=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prothsync/build.gradle | 3 +++ prothsync/monitoring/prometheus/prometheus.yml | 11 +++++++++++ .../prothsync/prothsync/config/SecurityConfig.java | 1 + prothsync/src/main/resources/application.yaml | 14 +++++++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 prothsync/monitoring/prometheus/prometheus.yml diff --git a/prothsync/build.gradle b/prothsync/build.gradle index f006036..517c331 100644 --- a/prothsync/build.gradle +++ b/prothsync/build.gradle @@ -48,6 +48,9 @@ dependencies { runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6' implementation 'org.springframework.boot:spring-boot-starter-webflux' + + implementation 'org.springframework.boot:spring-boot-starter-actuator' + runtimeOnly 'io.micrometer:micrometer-registry-prometheus' } tasks.named('test') { diff --git a/prothsync/monitoring/prometheus/prometheus.yml b/prothsync/monitoring/prometheus/prometheus.yml new file mode 100644 index 0000000..b778f9e --- /dev/null +++ b/prothsync/monitoring/prometheus/prometheus.yml @@ -0,0 +1,11 @@ +global: + scrape_interval: 15s # 15초마다 메트릭 수집 + evaluation_interval: 15s # 15초마다 알림 규칙 평가 + +scrape_configs: + - job_name: 'prothsync' + metrics_path: '/actuator/prometheus' + static_configs: + - targets: ['host.docker.internal:8080'] + labels: + application: 'prothsync' \ No newline at end of file diff --git a/prothsync/src/main/java/com/prothsync/prothsync/config/SecurityConfig.java b/prothsync/src/main/java/com/prothsync/prothsync/config/SecurityConfig.java index 2718cc5..bdc2cf5 100644 --- a/prothsync/src/main/java/com/prothsync/prothsync/config/SecurityConfig.java +++ b/prothsync/src/main/java/com/prothsync/prothsync/config/SecurityConfig.java @@ -43,6 +43,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .requestMatchers("/api/auth/signup", "/api/auth/login", "/api/auth/refresh").permitAll() // Swagger .requestMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll() + .requestMatchers("/actuator/health", "/actuator/prometheus").permitAll() .requestMatchers("/", "/index.html", "/css/**", "/js/**", "/images/**", "/favicon.ico").permitAll() // Posts - 공개 조회 .requestMatchers(HttpMethod.GET, "/api/posts").permitAll() diff --git a/prothsync/src/main/resources/application.yaml b/prothsync/src/main/resources/application.yaml index 1e7a1a4..f785d8a 100644 --- a/prothsync/src/main/resources/application.yaml +++ b/prothsync/src/main/resources/application.yaml @@ -31,4 +31,16 @@ jwt: kakao: rest-api-key: ${KAKAO_REST_API_KEY} geocoding: - base-url: https://dapi.kakao.com \ No newline at end of file + base-url: https://dapi.kakao.com + +management: + endpoints: + web: + exposure: + include: health, info, prometheus, metrics + endpoint: + health: + show-details: when-authorized + metrics: + tags: + application: prothsync \ No newline at end of file