Spring Boot & Jaeger in Action!
๐๐ป Spring Boot + Observability (OpenTracing) showcase

Father of two. DevOps Engineer. Interested in Cloud Development, Scalability, Java, CICD, and Seeking/Sharing Knowledge
Search for a command to run...
๐๐ป Spring Boot + Observability (OpenTracing) showcase

Father of two. DevOps Engineer. Interested in Cloud Development, Scalability, Java, CICD, and Seeking/Sharing Knowledge
No comments yet. Be the first to comment.
Sometimes, the best ideas come from playing around with simple projects. I recently set up an Arduino Nano RP2040 Connect to control an RGB LED ring via a web server written in Go. It turned out to be a fun and educational dive into IoT and web progr...

Dive into the core concept of "Shift Left" within the DevOps landscape. While this guide zeroes in on Java, Python, and Go configurations, the insights shared are valuable for developers across the board. Ready to explore? Let's jump in! ๐ Pro Tip!...

In the DevOps space, Observability is crucial to maintain a healthy and reliable solution. With logs, metrics, and traces, you can implement a setup that takes you from fixing your code issues on production to foreseeing issues before they even happen.
I developed a small Spring Boot microservice for this showcase that consumes data from two external APIs. In front of this service, I implemented a simple API-Gateway to accept and authenticate requests. Both services communicate with each other and produce traces to be visualized later on via our observability setup (Jaeger UI).
JDK17 & Gradle 7.5+
Docker & Docker-compose
rapidapi.com API key (Developer dashboard)

Java with Spring Boot provides a solid base to make it among the easiest technologies to instrument traces and visualize them using any UI of your choice. In this case, it will be Jaeger!
implementation 'io.opentracing.contrib:opentracing-spring-jaeger-cloud-starter:3.3.1'
@Bean
public RestTemplateBuilder restTemplateBuilder() {
return new RestTemplateBuilder();
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder){
return builder.build();
}
opentracing:
jaeger:
http-sender:
url: ${JAEGER_URI:http://localhost:14268/api/traces}
To get everything up and running, you will need the Rapidapi API Key that we mentioned as a prerequisite here. Then you need to subscribe to these two APIs:
Then, here is an ad-hoc docker-compose file to run the full example locally.
export RAPIDAPI_KEY=YOUR_KEY_HERE
docker-compose up
Now, call the api-gateway:
curl --location --request GET 'localhost:8081/random-meme/' \
--header 'Authorization: Basic YWRtaW46cGFzcw=='
Throughout this showcase, we utilized Spring framework to develop a reactive-web microservice and an API-Gateway. Following that, we dockerized these services and orchestrated them to have a running example. Finally, here is what to expect on JaegerUI after calling the services.

To get a closer look at both services, the Spring Boot memes service and the API Gateway, follow these two links:
%[https://github.com/HasanKhatib/random-meme]
๐ alkhatib.tech