Skip to content

Commit 6d2fdbe

Browse files
committed
implement tracing with sleuth and visualize them with zipkin
1 parent 1f25139 commit 6d2fdbe

File tree

9 files changed

+65
-0
lines changed

9 files changed

+65
-0
lines changed

customer/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4040
</dependency>
4141

42+
<dependency>
43+
<groupId>org.springframework.cloud</groupId>
44+
<artifactId>spring-cloud-starter-sleuth</artifactId>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.springframework.cloud</groupId>
49+
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
50+
</dependency>
51+
4252
<dependency>
4353
<groupId>com.hrk</groupId>
4454
<artifactId>clients</artifactId>

customer/src/main/resources/application.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
server:
22
port: 8080
3+
34
spring:
45
application:
56
name: customer
7+
68
datasource:
79
password: password
810
url: jdbc:postgresql://localhost:5434/customer
911
username: hrk
12+
1013
jpa:
1114
hibernate:
1215
ddl-auto: create-drop
@@ -15,6 +18,10 @@ spring:
1518
dialect: org.hibernate.dialect.PostgreSQLDialect
1619
format_sql: true
1720
show-sql: true
21+
22+
zipkin:
23+
base-url: http://localhost:9411
24+
1825
eureka:
1926
client:
2027
service-url:

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ services:
2727
networks:
2828
- postgres
2929
restart: unless-stopped
30+
zipkin:
31+
image: openzipkin/zipkin
32+
container_name: zipkin
33+
ports:
34+
- "9411:9411"
3035

3136
networks:
3237
postgres:

eureka-server/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
<groupId>org.springframework.cloud</groupId>
2323
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
2424
</dependency>
25+
26+
<dependency>
27+
<groupId>org.springframework.cloud</groupId>
28+
<artifactId>spring-cloud-starter-sleuth</artifactId>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.springframework.cloud</groupId>
33+
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
34+
</dependency>
2535
</dependencies>
2636

2737
<build>

eureka-server/src/main/resources/application.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ spring:
22
application:
33
name: eureka-server
44

5+
zipkin:
6+
base-url: http://localhost:9411
7+
58
server:
69
port: 8761
710

fraud/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4040
</dependency>
4141

42+
<dependency>
43+
<groupId>org.springframework.cloud</groupId>
44+
<artifactId>spring-cloud-starter-sleuth</artifactId>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.springframework.cloud</groupId>
49+
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
50+
</dependency>
51+
4252
<dependency>
4353
<groupId>com.hrk</groupId>
4454
<artifactId>clients</artifactId>

fraud/src/main/resources/application.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
server:
22
port: 8081
3+
34
spring:
45
application:
56
name: fraud
7+
68
datasource:
79
password: password
810
url: jdbc:postgresql://localhost:5434/fraud
911
username: hrk
12+
1013
jpa:
1114
hibernate:
1215
ddl-auto: create-drop
@@ -16,6 +19,9 @@ spring:
1619
format_sql: true
1720
show-sql: true
1821

22+
zipkin:
23+
base-url: http://localhost:9411
24+
1925
eureka:
2026
client:
2127
service-url:

notification/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4040
</dependency>
4141

42+
<dependency>
43+
<groupId>org.springframework.cloud</groupId>
44+
<artifactId>spring-cloud-starter-sleuth</artifactId>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.springframework.cloud</groupId>
49+
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
50+
</dependency>
51+
4252
<dependency>
4353
<groupId>com.hrk</groupId>
4454
<artifactId>clients</artifactId>

notification/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spring:
99
password: password
1010
url: jdbc:postgresql://localhost:5434/notification
1111
username: hrk
12+
1213
jpa:
1314
hibernate:
1415
ddl-auto: create-drop
@@ -18,6 +19,9 @@ spring:
1819
format_sql: true
1920
show-sql: true
2021

22+
zipkin:
23+
base-url: http://localhost:9411
24+
2125
eureka:
2226
client:
2327
service-url:

0 commit comments

Comments
 (0)