Distributed Tracing in Micro Services with Jaeger
Jaeger is open source tool which created by uber for distributed tracing in between micro services.
Why We need Distributed Tracing in Micro services?
when it is come to micro service architecture most challenging task is inter continuation. Now a days when dealing with micro services we have to think about the each service execution time. For that is why needs to use distributed tracing mechanism across the micro services.
Assume that we need to trace the requests when customer send request to BFF Service. Here we are using spring boot to write the micro services.
Step 1: Add Dependencies & configurations
In this tutorial I am using spring boot to write micro services so these are the dependencies you have to add to maven project.
And add these configs in yml file.
This is the configuration for connect to jaeger Server Instance. And finally Create separate config file & add the following beans to identify the module details in jaeger server.
Like this way all the micro-services needs to update.
Step 2: Start JAEGER Server & UI for Testing
We can use docker to start jaeger sever & UI .
Once the jaeger UI started you can access in here.
Then we can trace the API request in the UI.
As example this is the one request show in the jaeger UI. API execution time is 2.11s. There are two module which have records in that request.
And when we click the request it shows each module API execution time. From my example Payment gateway is the one took more execution time. It is 1.85s but actually third party connection which took 1.74s . This way we can identify the bottleneck in micro-services.