Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion company/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions company/src/main/resources/application-monitor.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions company/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
profiles:
include:
- monitor

springdoc:
api-docs:
Expand Down
42 changes: 42 additions & 0 deletions company/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty name="SERVICE_NAME" source="spring.application.name"/>
<springProperty name="HOSTNAME" source="HOSTNAME" defaultValue="localhost"/>
<springProperty name="LOKI_URL" source="loki.url" defaultValue="http://localhost:3100/loki/api/v1/push"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>${LOKI_URL}</url>
</http>

<labels>
app=${SERVICE_NAME}
host=${HOSTNAME}
</labels>

<structuredMetadata>
level=%level
logger=%logger
thread=%thread
traceId=%X{traceId:-}
spanId=%X{spanId:-}
</structuredMetadata>

<message>
<pattern>%msg%n</pattern>
</message>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI"/>
</root>

<logger name="com.hubEleven" level="DEBUG"/>
</configuration>
9 changes: 8 additions & 1 deletion delivery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(); // 나머지 모든 요청은 인증 필요
})
Expand Down
15 changes: 15 additions & 0 deletions delivery/src/main/resources/application-monitor.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions delivery/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions delivery/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty name="SERVICE_NAME" source="spring.application.name"/>
<springProperty name="HOSTNAME" source="HOSTNAME" defaultValue="localhost"/>
<springProperty name="LOKI_URL" source="loki.url" defaultValue="http://localhost:3100/loki/api/v1/push"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>${LOKI_URL}</url>
</http>

<labels>
app=${SERVICE_NAME}
host=${HOSTNAME}
</labels>

<structuredMetadata>
level=%level
logger=%logger
thread=%thread
traceId=%X{traceId:-}
spanId=%X{spanId:-}
</structuredMetadata>

<message>
<pattern>%msg%n</pattern>
</message>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI"/>
</root>

<logger name="com.hubEleven" level="DEBUG"/>
</configuration>
8 changes: 7 additions & 1 deletion gateWay/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions gateWay/src/main/resources/application-monitor.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions gateWay/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ eureka:
service-url:
defaultZone: http://localhost:8761/eureka
spring:
profiles:
include:
- monitor
cloud:
gateway:
routes:
Expand Down
42 changes: 42 additions & 0 deletions gateWay/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty name="SERVICE_NAME" source="spring.application.name"/>
<springProperty name="HOSTNAME" source="HOSTNAME" defaultValue="localhost"/>
<springProperty name="LOKI_URL" source="loki.url" defaultValue="http://localhost:3100/loki/api/v1/push"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>${LOKI_URL}</url>
</http>

<labels>
app=${SERVICE_NAME}
host=${HOSTNAME}
</labels>

<structuredMetadata>
level=%level
logger=%logger
thread=%thread
traceId=%X{traceId:-}
spanId=%X{spanId:-}
</structuredMetadata>

<message>
<pattern>%msg%n</pattern>
</message>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI"/>
</root>

<logger name="com.hubEleven" level="DEBUG"/>
</configuration>
8 changes: 7 additions & 1 deletion hub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions hub/src/main/resources/application-monitor.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions hub/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ spring:
discovery:
enabled: true
service-id: config
profiles:
include:
- monitor
cache:
type: simple # simple = ConcurrentMapCacheManager / redis = redis 사용
cache-names:
Expand Down
42 changes: 42 additions & 0 deletions hub/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty name="SERVICE_NAME" source="spring.application.name"/>
<springProperty name="HOSTNAME" source="HOSTNAME" defaultValue="localhost"/>
<springProperty name="LOKI_URL" source="loki.url" defaultValue="http://localhost:3100/loki/api/v1/push"/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}] [%X{spanId:-}] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>${LOKI_URL}</url>
</http>

<labels>
app=${SERVICE_NAME}
host=${HOSTNAME}
</labels>

<structuredMetadata>
level=%level
logger=%logger
thread=%thread
traceId=%X{traceId:-}
spanId=%X{spanId:-}
</structuredMetadata>

<message>
<pattern>%msg%n</pattern>
</message>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI"/>
</root>

<logger name="com.hubEleven" level="DEBUG"/>
</configuration>
9 changes: 8 additions & 1 deletion notification/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading