This website uses cookies to ensure you get the best experience on our website.

Skip to content
LOGO
  • Company

    About IGNEK

    Learn about our story and our mission.

    Careers

    We're hiring!

    We always looking for talented peoples. Join our team!

    Blogs

    The latest industry news, updates and info.

    Case Studies

    Take a closer look at the projects we've delivered

    Webinar

    Watch our latest organized webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Custom Enterprise Portal Development for flawless Solutions

    Dedicated Development Team

    Expand Teams, Optimize Development with Our Expertise

    Back-end Development

    Empowering your digital presence with robust backend development expertise

    Front-end Development

    Crafting engaging user experiences through expert frontend development

    Digital Transformation

    Embrace digital transformation by modernizing process

    SaaS Development

    Transform your business with SaaS Innovative Solutions

    Technologies

    Liferay Services

    Development & Customization

    Theme

    Upgradation

    Migration

    Proof of Concept

    Performance Tunning

    Architecture

    Support & Maintenance

    E-commerce

    Expert Advice

    React Services

    Enterprise Development

    Custom Application

    Single Page Application

    Architecture

    API Integration

    Migration

    Consulting

    Maintenance & Support

    Spring Boot Services

    Web Service

    MVC Web Development

    API Integration

    Security

    Migration

    Microservices

    Support & Maintenance

    AEM Services

    Consulting Service

    Site Development

    Migration & Upgradation

    Integration

    Maintenance & Support

    Custom Solutions

    Content Management

    Team Augementation

  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Transforming industries through cutting edge SaaS solutions.

    Customer Portal : Boost Business Productivity

    Streamline operations and enhance productivity with our Customer Portal solution.

    Liferay Based Intranet Portal

    Internal portal for company communication, collaboration and resources

    Integration

    Matomo Integration with Liferay

    Integrate Matomo to enable user interactions seamlessly.

    Microsoft Teams integration with Liferay

    Integrate to enable seamless collaboration, messaging within your portal.

    Jira Integration With Liferay

    Optimizes business operations by integrating with Jira.

  • Hire Us

    Liferay

    Get expert Liferay developers for seamless portal solutions.

    React JS

    Get expert ReactJS developers for dynamic web solutions.

    Web Developer

    Get custom web solutions from IGNEK's expert developers.

    Spring Boot

    Get top-notch Spring Boot developers for your project success!

    Healthcare

    Get top Healthcare Developers for cutting-edge medical software.

    MERN Stack

    Get expert MERN developers from IGNEK for custom, innovative project solutions.

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • info@ignek.com
    • Ahmedabad, Gujarat, India – 382470
SCHEDULE CALL
  • COMPANY
    • About
    • Case Studies
    • Blogs
    • Career
    • Webinar
  • SERVICES
    • Enterprise Portal Development
    • Dedicated Development Team
    • Back-end Development
    • Front-end Development
    • Digital Transformation
    • SaaS Development
  • SOLUTION
    • Customer Portal:  Boost Business Productivity
    • SaaS : Software as a Service
    • Liferay Based Employee Intranet Portal
  • TECHNOLOGY
    • Liferay Services
      • Liferay Development and Customization
      • Liferay Theme Development Service
      • Liferay DXP 7.4 Upgrade
      • Liferay Migration
      • Liferay Proof Of Concept
      • Liferay Performance Tuning
      • Liferay Architecture Design Service
      • Liferay Support And Maintenance Service
      • Liferay Ecommerce Development
      • Liferay Expert Advice
    • ReactJS Services
      • ReactJS Enterprise Application Development
      • ReactJS Custom Application Development
      • ReactJS Single Page Application Development (SPA)
      • ReactJS Applications Architecture
      • ReactJS API Integration
      • ReactJS Migration
      • ReactJS Consulting
      • ReactJS Maintenance and Support
    • Spring Boot Services
      • Spring Boot Web Development Service
      • Spring MVC Web Development
      • Spring Boot API Integration Service
      • Spring Boot Security
      • Spring Boot Migration Service
      • Spring Boot Microservices
      • Spring Boot Support & Maintenance Service
    • AEM Development Services
      • AEM Consulting Services
      • AEM Site Development
      • AEM Migration & Upgradation
      • AEM Integration Services
      • AEM Maintenance & Support
      • AEM Content Management
      • Custom AEM Solutions
      • AEM Team Augmentation
  • INTEGRATION
  • HIRE US
    • Hire Liferay Developer
    • Hire ReactJS Developer
    • Hire Spring Boot Developer
    • Hire Healthcare Developer
    • Hire Web Developer
    • Hire MERN Stack Developer
  • CONTACT US
  • Company

    About IGNEK

    Careers

    We're hiring!

    Blogs

    Case Studies

    Webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Dedicated Development Team

    Back-end Development

    Front-end Development

    Digital Transformation

    SaaS Development

    Technologies

    Liferay Liferay Services
    • Development & Customization
    • Theme
    • Upgradation
    • Migration
    • Proof of Concept
    • Performance Tuning
    • Architecture
    • Support & Maintenance
    • E-commerce
    • Expert Advice
    React React Services
    • Enterprise Development
    • Custom Application
    • Single Page Application
    • Architecture
    • API Integration
    • Migration
    • Consulting
    • Maintenance & Support
    Spring Boot Spring Boot Services
    • Web Service
    • MVC Web Development
    • API Integration
    • Security
    • Migration
    • Microservices
    • Support & Maintenance
    AEM AEM Services
    • Consulting Service
    • Site Development
    • Migration & Upgradation
    • Integration
    • Maintenance & Support
    • Custom Solutions
    • Content Management
    • Team Augmentation
  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Customer Portal : Boost Business Productivity

    Liferay Based Intranet Portal

    Integration

    Matomo Integration with Liferay

    Microsoft Teams integration with Liferay

    Jira Integration With Liferay

  • Hire Us

    Liferay

    React JS

    Web Developer

    Spring Boot

    Healthcare

    MERN Stack

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • IGNEK
    • Ahmedabad, Gujarat, India – 382470
  • SCHEDULE CALL

Distributed Tracing in Microservices With Spring boot 3.0

  • Spring Boot
  • September 13, 2024

Share On :

Introduction

As microservices architecture grows in complexity, managing, debugging, and monitoring service interactions can become quite challenging. One of the most effective tools for understanding and troubleshooting such distributed systems is Distributed Tracing. It enables tracking of requests as they flow through multiple services in a microservices architecture, helping you to monitor the performance of individual services and pinpoint where bottlenecks or failures occur.

In this blog, we’ll explain the concept of distributed tracing and demonstrate its implementation using a demo microservices architecture for an online learning platform. The platform consists of microservices such as eureka-server (discovery service), api-gateway, user-service, course-service, and admin-service. We’ll also use Zipkin, a popular distributed tracing system, to trace requests across these services.

What is Distributed Tracing

Distributed tracing is a technique to trace the flow of a request through multiple microservices in a distributed architecture. It helps to:

  • Visualize request flow across services.
  • Identify bottlenecks and performance issues.
  • Diagnose errors and failures more effectively.
  • Provide insights into inter-service communication latencies.

Key components in distributed tracing:

  • Trace : Represents the entire journey of a request across different microservices.
  • Span : A single operation within the trace, often representing one service’s processing.
  • Parent/Child Spans : Relationships between operations, showing which services called others.

Here in demo, A request to fetch students-course details  our system travels through multiple services:

  • API Gateway : Acts as the entry point for the request.
  • User Service : Retrieves user details.
  • Course Service : Fetches the courses related to the user.
Distributed tracing workflow

By enabling distributed tracing, we can track this request as it moves through these services, measure the time spent in each service, and diagnose any issues along the way.

Tracing will automatically be enabled across the microservices. Spring Cloud Sleuth will add a trace ID and span ID to each request, which will be logged and passed across service boundaries.

Key Benefits of Distributed Tracing
  • Improved Observability : Visualize the complete path of requests, making debugging easier.
  • Error Detection : Easily identify which service is causing performance issues or errors.
  • Performance Optimization : Pinpoint bottlenecks and reduce latency across microservices.
Prerequisites
  • Java 17 : Our microservices are built using Spring Boot, which runs on Java 17.
  • Maven : Maven is required for building Spring Boot projects. 
  • Spring Boot Development Environment (here IntelliJ IDEA).
  • Zipkin : For tracing requests.
Setting Up  Spring Boot Application

Create  Microservices that you need for your application. I’m going to implemented a  dummy project for an online learning platform, which includes services like eureka-server (discovery service), api-gateway, user-service, course-service, and admin-service.

Step 1 : Configuring Spring Boot for Distributed Tracing

Spring Boot offers support for distributed tracing through Spring Cloud Sleuth, which automatically instruments your application to generate trace and span IDs for each request. By default, Sleuth sends these tracing data to Zipkin.

				
					<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>

				
			

Add the dependencies for Sleuth and Zipkin in the pom.xml of each microservice:

Step 2 : Configure application properties

Configure application properties to enable Sleuth and Zipkin. In each service’s application.properties:

				
					spring.zipkin.base-url=http://zipkin:9411
spring.sleuth.sampler.probability=1.0

				
			
  • spring.zipkin.base-url : Defines the URL of the Zipkin server.
  • spring.sleuth.sampler.probability : Set to 1.0 to trace 100% of requests (for testing purposes)

With this setup, each request that goes through the microservices will automatically generate trace data and send it to Zipkin.

Step 3 : Setting up Zipkin in Docker(If use docker)

Zipkin is a popular tool used for distributed tracing. We’ll run Zipkin in a Docker container.

Add Zipkin to your docker-compose.yml:

				
					services:
  # Other microservices definitions
  zipkin:
    image: openzipkin/zipkin
    container_name: zipkin
    ports:
      - "9411:9411"
    networks:
      - microservices-network

				
			

The zipkin service will be available at http://localhost:9411 after running Docker Compose.

Step 4 : Running the Microservices and Zipkin(If use docker)

Now that we have Zipkin and distributed tracing enabled, let’s run the entire setup:

				
					docker-compose up --build
				
			

This command will:

  • Build and start each microservice in a container.
  • Start the Zipkin service.
  • Register all microservices with Eureka and open their respective ports.

Step 5 : Testing Distributed Tracing

Once everything is up and running, you can trigger requests that flow through multiple services.

For example

  • A client makes a request to the API Gateway at http://localhost:8080.
  • The API Gateway forwards the request to the appropriate microservice.
  • Each service processes the request and communicates with other services as needed.
  • Sleuth traces the request and its journey through various services, and sends the trace data to Zipkin.

Step 6 :  Viewing Traces in Zipkin

After running a few requests, open Zipkin’s web interface by visiting http://localhost:9411.

You’ll see a list of traces, showing how requests traveled across the services. By selecting a specific trace, you can view the detailed breakdown, including:

  • Duration of each service’s response.
  • Latency between services.
  • Error details (if any) for failed requests.

You can also drill down into individual spans to see how long each operation took and identify performance bottlenecks or failure points.

Conclusion

Distributed tracing is an essential tool for gaining insight into the performance and health of a microservices architecture. By using Spring Cloud Sleuth and Zipkin, we can efficiently trace and monitor requests across various services in our microservices ecosystem.

In this guide, we demonstrated how to implement distributed tracing in a microservices-based online learning platform with Dockerized Spring Boot services. This setup enables seamless tracing and monitoring of requests across the eureka-server, API-gateway, user-service, course-service, and admin-service.

By leveraging distributed tracing, developers and operations teams can more easily debug, monitor, and improve the performance of their distributed systems.

Explore Our Services

Discover how we can help your business thrive, whether you’re running a small startup, an SME, or a large enterprise. We’re here to understand your unique needs and goals, offering the expertise and resources to support your journey to success.

Stay informed about our Spring Boot services and updates by subscribing to our newsletter—just fill in the details below to subscribe.

Loading
Loading...

Related Blogs

March 28, 2024
Spring Boot With Docker
Dockerize Spring Boot Application
August 30, 2024
Building Resilient Spring Boot Microservices with Circuit Breaker Patterns using Resilience4j
Building Resilient Spring Boot Microservices with Circuit Breaker Patterns using Resilience4j
September 17, 2024
Dockerized Microservices in springBoot
Dockerized Microservices in springBoot 
Loading...

Digital Solutions for Your Business with IGNEK

4.9

5.0

5.0

5.0

LOGO

Making the world a better place through constructing elegant hierarchies

COMPANY

  • About
  • Career
  • Case Study
  • Blogs

SERVICES

  • Enterprise Portal Development
  • Dedicated Development Team
  • Back-end Development
  • Front-end Development
  • Digital Transformation
  • SaaS Development

HIRE US

  • Liferay
  • Spring Boot
  • ReactJS
  • Healthcare
  • MERN Stack
  • AEM

CONTACT

  • info@ignek.com
  • info@ignek.com
SALES
  • sales@ignek.com
  • (+91) 635 157 6580
CAREER
  • hr@ignek.com
  • (+91) 932 849 5160
  • E 910-912, Ganesh Glory 11, Jagatpur Road, SG Highway, Ahmedabad, Gujarat - 382470

© 2018-2025 IGNEK, Inc. All rights reserved

Linkedin Facebook X-twitter Instagram