Skip to content
Merged
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
4 changes: 4 additions & 0 deletions common/core/src/main/resources/application-eureka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eureka:
client:
service-url:
defaultZone: http://eureka-server:10000/eureka/
50 changes: 50 additions & 0 deletions common/monitoring/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
}

group = 'com.ticketPing'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

bootJar {
enabled = false
}

jar {
enabled = true
}

dependencies {
// Monitoring
api 'org.springframework.boot:spring-boot-starter-actuator'
api 'io.micrometer:micrometer-registry-prometheus'

// Loki
api 'com.github.loki4j:loki-logback-appender:1.5.1'

// Zipkin
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation 'io.github.openfeign:feign-micrometer'
implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
}

tasks.named('test') {
useJUnitPlatform()
}
17 changes: 17 additions & 0 deletions common/monitoring/src/main/resources/application-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
prometheus:
enabled: true

zipkin:
tracing:
endpoint: "http://localhost:9411/api/v2/spans"
tracing:
sampling:
probability: 1.0
4 changes: 4 additions & 0 deletions common/monitoring/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spring:
application:
name: common-monitoring

8 changes: 8 additions & 0 deletions docker-compose-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ services:
networks:
- monitoring

zipkin:
image: openzipkin/zipkin
container_name: zipkin
ports:
- "9411:9411"
networks:
- monitoring

networks:
monitoring:
driver: bridge
6 changes: 2 additions & 4 deletions gateway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ ext {
}

dependencies {
// Common Module
implementation project(':common:caching')
implementation project(':common:monitoring')

// Cloud
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
Expand All @@ -39,10 +41,6 @@ dependencies {

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.0.2'

// Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
}

dependencyManagement {
Expand Down
18 changes: 2 additions & 16 deletions gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@ spring:

config:
import:
- "classpath:application-eureka.yml"
- "classpath:application-redis.yml"
- "classpath:application-monitoring.yml"

server:
port: 10001

eureka:
client:
service-url:
defaultZone: http://eureka-server:10000/eureka/

management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
prometheus:
enabled: true

token-value:
secret-key: secret-key

Expand Down
23 changes: 23 additions & 0 deletions gateway/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX} %level ${PID:-} --- [%20t] %C : %msg%n</pattern>
</encoder>
</appender>
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>http://localhost:3100/loki/api/v1/push</url>
</http>
<format>
<label>
<pattern>service=gateway-service</pattern>
</label>
<message class="com.github.loki4j.logback.JsonLayout" />
</format>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI" />
</root>
</configuration>
19 changes: 10 additions & 9 deletions monitoring/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,38 @@ global:
scrape_interval: 15s

scrape_configs:
- job_name: auth-server

- job_name: gateway-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10010' ]
- targets: [ 'host.docker.internal:10001' ]

- job_name: gateway-server
- job_name: auth-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10020' ]
- targets: [ 'host.docker.internal:10010' ]

- job_name: user-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10021' ]
- targets: [ 'host.docker.internal:10011' ]

- job_name: performance-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10022' ]
- targets: [ 'host.docker.internal:10012' ]

- job_name: order-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10023' ]
- targets: [ 'host.docker.internal:10013' ]

- job_name: payment-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10024' ]
- targets: [ 'host.docker.internal:10014' ]

- job_name: queue-manage-server
metrics_path: '/actuator/prometheus'
static_configs:
- targets: [ 'host.docker.internal:10031']
- targets: [ 'host.docker.internal:10015']
6 changes: 1 addition & 5 deletions services/auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies {
implementation project(':common:core')
implementation project(':common:dtos')
implementation project(':common:caching')
implementation project(':common:monitoring')

// MVC
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand All @@ -56,11 +57,6 @@ dependencies {

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
implementation 'com.github.loki4j:loki-logback-appender:1.5.1'
}

tasks.named('test') {
Expand Down
18 changes: 2 additions & 16 deletions services/auth/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@ spring:

config:
import:
- "classpath:application-eureka.yml"
- "classpath:application-redis.yml"
- "classpath:application-monitoring.yml"

server:
port: 10010

eureka:
client:
service-url:
defaultZone: http://eureka-server:10000/eureka/

management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
prometheus:
enabled: true

jwt:
secret: ${JWT_SECRET_KEY}
6 changes: 2 additions & 4 deletions services/order/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ dependencyManagement {
}

dependencies {
// Common Module
implementation project(':common:core')
implementation project(':common:dtos')
implementation project(':common:jpa')
implementation project(':common:caching')
implementation project(':common:messaging')
implementation project(':common:monitoring')

// MVC
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand All @@ -49,10 +51,6 @@ dependencies {

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down
18 changes: 2 additions & 16 deletions services/order/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,11 @@ spring:

config:
import:
- "classpath:application-eureka.yml"
- "classpath:application-jpa.yml"
- "classpath:application-redis.yml"
- "classpath:application-kafka.yml"
- "classpath:application-monitoring.yml"

server:
port: 10013

eureka:
client:
service-url:
defaultZone: http://eureka-server:10000/eureka/

management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
prometheus:
enabled: true
23 changes: 23 additions & 0 deletions services/order/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX} %level ${PID:-} --- [%20t] %C : %msg%n</pattern>
</encoder>
</appender>
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
<http>
<url>http://localhost:3100/loki/api/v1/push</url>
</http>
<format>
<label>
<pattern>service=order-service</pattern>
</label>
<message class="com.github.loki4j.logback.JsonLayout" />
</format>
</appender>

<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="LOKI" />
</root>
</configuration>
5 changes: 1 addition & 4 deletions services/payment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
implementation project(':common:dtos')
implementation project(':common:jpa')
implementation project(':common:messaging')
implementation project(':common:monitoring')

// MVC
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand All @@ -49,10 +50,6 @@ dependencies {

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down
18 changes: 2 additions & 16 deletions services/payment/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,10 @@ spring:

config:
import:
- "classpath:application-eureka.yml"
- "classpath:application-jpa.yml"
- "classpath:application-kafka.yml"
- "classpath:application-monitoring.yml"

server:
port: 10014

eureka:
client:
service-url:
defaultZone: http://eureka-server:10000/eureka/

management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
prometheus:
enabled: true
Loading