diff --git a/company/build.gradle b/company/build.gradle
index 502509eb..0e1e2600 100644
--- a/company/build.gradle
+++ b/company/build.gradle
@@ -46,12 +46,18 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
+
}
dependencyManagement {
diff --git a/company/src/main/resources/application-monitor.yml b/company/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/company/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/company/src/main/resources/application.yml b/company/src/main/resources/application.yml
index 6bcd3cdd..d5e830a4 100644
--- a/company/src/main/resources/application.yml
+++ b/company/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
springdoc:
api-docs:
diff --git a/company/src/main/resources/logback-spring.xml b/company/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/company/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/delivery/build.gradle b/delivery/build.gradle
index 3925ea60..ec080f39 100644
--- a/delivery/build.gradle
+++ b/delivery/build.gradle
@@ -56,11 +56,18 @@ dependencies {
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-stub-runner'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
+
implementation 'com.github.Doritosch:commonLib:1.0.5'
//맥에서 webflux
diff --git a/delivery/src/main/java/com/hubEleven/delivery/infrastructure/security/SecurityConfig.java b/delivery/src/main/java/com/hubEleven/delivery/infrastructure/security/SecurityConfig.java
index 305a2a5f..07cc9e74 100644
--- a/delivery/src/main/java/com/hubEleven/delivery/infrastructure/security/SecurityConfig.java
+++ b/delivery/src/main/java/com/hubEleven/delivery/infrastructure/security/SecurityConfig.java
@@ -21,6 +21,7 @@ public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http)
.addFilterAt(headerAuthFilter, SecurityWebFiltersOrder.AUTHENTICATION)
.authorizeExchange(
exchange -> {
+ exchange.pathMatchers("/actuator/**").permitAll();
// PUBLIC_PATHS 설정은 Delivery Service에 필요하다면 추가
exchange.anyExchange().authenticated(); // 나머지 모든 요청은 인증 필요
})
diff --git a/delivery/src/main/resources/application-monitor.yml b/delivery/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/delivery/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/delivery/src/main/resources/application.yml b/delivery/src/main/resources/application.yml
index 2cc11375..3bfc27d2 100644
--- a/delivery/src/main/resources/application.yml
+++ b/delivery/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/hubEleven?useSSL=false&serverTimezone=Asia/Seoul&characterEncoding=UTF-8
diff --git a/delivery/src/main/resources/logback-spring.xml b/delivery/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/delivery/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/gateWay/build.gradle b/gateWay/build.gradle
index c098a43a..fd555702 100644
--- a/gateWay/build.gradle
+++ b/gateWay/build.gradle
@@ -43,11 +43,17 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
}
dependencyManagement {
diff --git a/gateWay/src/main/resources/application-monitor.yml b/gateWay/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/gateWay/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/gateWay/src/main/resources/application.yml b/gateWay/src/main/resources/application.yml
index 162cdcfb..07cf0978 100644
--- a/gateWay/src/main/resources/application.yml
+++ b/gateWay/src/main/resources/application.yml
@@ -5,6 +5,9 @@ eureka:
service-url:
defaultZone: http://localhost:8761/eureka
spring:
+ profiles:
+ include:
+ - monitor
cloud:
gateway:
routes:
diff --git a/gateWay/src/main/resources/logback-spring.xml b/gateWay/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/gateWay/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/hub/build.gradle b/hub/build.gradle
index 9ef14424..26746809 100644
--- a/hub/build.gradle
+++ b/hub/build.gradle
@@ -43,11 +43,17 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.github.Doritosch:commonLib:1.0.5'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
}
dependencyManagement {
diff --git a/hub/src/main/resources/application-monitor.yml b/hub/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/hub/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/hub/src/main/resources/application.yml b/hub/src/main/resources/application.yml
index 1d7b4aca..e327d6e0 100644
--- a/hub/src/main/resources/application.yml
+++ b/hub/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
cache:
type: simple # simple = ConcurrentMapCacheManager / redis = redis 사용
cache-names:
diff --git a/hub/src/main/resources/logback-spring.xml b/hub/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/hub/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/notification/build.gradle b/notification/build.gradle
index 0b1aba40..ff0f94ce 100644
--- a/notification/build.gradle
+++ b/notification/build.gradle
@@ -48,11 +48,18 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
+
}
dependencyManagement {
diff --git a/notification/src/main/resources/application-monitor.yml b/notification/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/notification/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/notification/src/main/resources/application.yml b/notification/src/main/resources/application.yml
index 0618bf4f..4b285ee3 100644
--- a/notification/src/main/resources/application.yml
+++ b/notification/src/main/resources/application.yml
@@ -15,3 +15,4 @@ spring:
include:
- eureka
- swagger
+ - monitor
diff --git a/notification/src/main/resources/logback-spring.xml b/notification/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/notification/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/order/build.gradle b/order/build.gradle
index afe591f1..fe7d72a7 100644
--- a/order/build.gradle
+++ b/order/build.gradle
@@ -45,11 +45,17 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
}
dependencyManagement {
diff --git a/order/src/main/resources/application-monitor.yml b/order/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/order/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/order/src/main/resources/application.yml b/order/src/main/resources/application.yml
index d920d4f0..42a1e5c0 100644
--- a/order/src/main/resources/application.yml
+++ b/order/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
eureka:
client:
diff --git a/order/src/main/resources/logback-spring.xml b/order/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/order/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/product/build.gradle b/product/build.gradle
index d6804ca4..41312510 100644
--- a/product/build.gradle
+++ b/product/build.gradle
@@ -44,12 +44,18 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
+
}
dependencyManagement {
diff --git a/product/src/main/resources/application-monitor.yml b/product/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/product/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/product/src/main/resources/application.yml b/product/src/main/resources/application.yml
index 727f30dd..1ef72702 100644
--- a/product/src/main/resources/application.yml
+++ b/product/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
eureka:
client:
diff --git a/product/src/main/resources/logback-spring.xml b/product/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/product/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/user/build.gradle b/user/build.gradle
index d7644726..19bafbf3 100644
--- a/user/build.gradle
+++ b/user/build.gradle
@@ -46,12 +46,18 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
- // zipkin
+ // actuator + metrics
implementation 'org.springframework.boot:spring-boot-starter-actuator'
+ runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
+
+ // tracing (brave + zipkin)
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
implementation 'io.github.openfeign:feign-micrometer'
+ // logging -> loki (push)
+ implementation 'com.github.loki4j:loki-logback-appender:2.0.1'
+
}
dependencyManagement {
diff --git a/user/src/main/java/com/hubEleven/user/infrastructure/config/SecurityConfig.java b/user/src/main/java/com/hubEleven/user/infrastructure/config/SecurityConfig.java
index 56f03151..2244193d 100644
--- a/user/src/main/java/com/hubEleven/user/infrastructure/config/SecurityConfig.java
+++ b/user/src/main/java/com/hubEleven/user/infrastructure/config/SecurityConfig.java
@@ -54,6 +54,7 @@ SecurityFilterChain publicSecurityFilterChain(HttpSecurity http) throws Exceptio
return http.securityMatcher(
"/v1/user/login",
"/v1/user/signup",
+ "/actuator/**",
"/api-docs/**",
"/v3/api-docs/**",
"/swagger-ui/**",
diff --git a/user/src/main/resources/application-monitor.yml b/user/src/main/resources/application-monitor.yml
new file mode 100644
index 00000000..18698073
--- /dev/null
+++ b/user/src/main/resources/application-monitor.yml
@@ -0,0 +1,15 @@
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - health
+ - prometheus
+ - info
+ metrics:
+ tags:
+ application: ${spring.application.name}
+ instance: ${spring.cloud.client.hostname}:${server.port}
+ endpoint:
+ health:
+ show-details: always
\ No newline at end of file
diff --git a/user/src/main/resources/application.yml b/user/src/main/resources/application.yml
index 5c9e9425..51fa0a0f 100644
--- a/user/src/main/resources/application.yml
+++ b/user/src/main/resources/application.yml
@@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
+ profiles:
+ include:
+ - monitor
management:
endpoints:
diff --git a/user/src/main/resources/logback-spring.xml b/user/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..c4cdea38
--- /dev/null
+++ b/user/src/main/resources/logback-spring.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ ${LOKI_URL}
+
+
+
+ app=${SERVICE_NAME}
+ host=${HOSTNAME}
+
+
+
+ level=%level
+ logger=%logger
+ thread=%thread
+ traceId=%X{traceId:-}
+ spanId=%X{spanId:-}
+
+
+
+ %msg%n
+
+
+
+
+
+
+
+
+
+