Adding distributed tracing to the source code
In this section, we will learn how to update the source code to enable distributed tracing. This can be done with the following steps:
- Add dependencies to the build files to bring in Micrometer Tracing with a tracer implementation and a reporter.
- Add a Zipkin server to the Docker Compose files.
- Configure the microservices to send trace information to Zipkin.
- Add workarounds for the lacking support of reactive clients.
- Add code for creating custom spans and custom tags in existing spans.
We will go through each of the steps in turn.
Adding dependencies to build files
To be able to utilize Micrometer Tracing and the ability to export trace information to Zipkin, we need to add a dependency to the selected tracer and reporter to the Gradle project build files, build.gradle
.
This is accomplished by adding the following two lines:
implementation 'io.micrometer:micrometer-tracing...