UPDATE Feb 02, 2024
From Spring Boot 3.2, it will automatically add application name, trace id, and span id to log. The only thing you need to do is add micrometer dependency then setup zipkin:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
implementation "io.micrometer:micrometer-tracing-bridge-brave"
If you want to work your program which is using Spring Boot 3.0.0 Version. You can follow this way:
1) Please add the following dependencies from your pom.xml:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-micrometer</artifactId>
</dependency>
2) Please configure your application.properties (if you use application.properties):
management.tracing.sampling.probability=0.1
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
3) The last step is running the zipkin from docker (be sure docker must be running before the running this command):
docker run --rm -it --name zipkin -p 9411:9411 openzipkin/zipkin