Spring Boot 3 Demo Tracing with Jaeger

A simple Spring Boot 3 multi-module project with OpenTelemetry, Jaeger, and Prometheus for observability.

Sopheaktra

Eang Sopheaktra

May 29 2025 02:47 pm

0 104

🌟 Observability in a Simple Multi-Module Spring Boot 3 App

Most observability tutorials focus on microservices or heavy Domain-Driven Design (DDD) projects. But what if you're just working on a simple multi-module Spring Boot 3 application?

Good news: you can still integrate tracing and metrics like a pro.

In this post, I’ll walk you through how I built a simple, standalone Spring Boot 3 project with:

  • ✅ Gradle multi-module setup

  • OpenTelemetry for distributed tracing

  • Jaeger to visualize traces

  • Prometheus + Micrometer for metrics

  • ✅ Docker Compose to run the full observability stack locally

🔧 Why Multi-Module?

Multi-module projects in Gradle help with:

  • Separation of concerns (e.g., separating web, core logic, and config)

  • Faster builds

  • Better organization for growing projects

This project has basic modules like:

  • client-consumer – for handle consume api, webClient for external and internal api.

  • logging – handle log4j2 for service need logging.

  • service-a & service-b – testing service

  • tracing – tracing and metrics setup for base module

📦 Project Setup

Clone the Repo

git clone https://github.com/Tra22/spring-boot-3-demo-tracing.git 
cd spring-boot-3-demo-tracing

This starts:

🔍 Tracing with OpenTelemetry

OpenTelemetry is added via the Java agent. It automatically traces:

  • Incoming HTTP requests

  • Spring controllers

  • Any custom spans you define

Jaeger helps you visualize the trace flow, even within a single app.


📊 Metrics with Prometheus + Micrometer

Spring Boot 3 uses Micrometer to expose JVM and request metrics via:

service-a: http://localhost:8080/actuator/prometheus
service-b: http://localhost:8081/actuator/prometheus

Prometheus scrapes this and lets you query:

  • http_server_requests_seconds_count

  • jvm_memory_used_bytes

  • system_cpu_usage


💡 Key Benefits

  • No microservices needed

  • Simple Gradle multi-module setup

  • Visibility into your app's behavior

  • Easily portable to production or cloud environments


🔗 Repo

🧰 Code: github.com/Tra22/spring-boot-3-demo-tracing


🏁 Wrap-Up

If you're building a Spring Boot app and want clean code and observability without the complexity of DDD or microservices, this approach gives you the best of both worlds.

You’ll get:

  • A better understanding of your system

  • Easier performance debugging

  • A strong foundation for future growth


✅ Give the repo a ⭐ on GitHub if you found it useful.
🛠️ Feel free to fork it and customize for your own projects.

This post is not allow comment!

Subscribe to our newsletter.

Get updates about new articles, contents, coding tips and tricks.

Weekly articles
Always new release articles every week or weekly released.
No spam
No marketing, share and spam you different notification.
© 2023-2025 Tra21, Inc. All rights reserved.