image
Transaction Tracking
Start course
Difficulty
Beginner
Duration
59m
Students
92
Ratings
5/5
Description

In this course, we will learn the concepts of microservice and spring framework and focus on Microservice concerns.

Learning Objectives

  • Health Checks
  • Alerts
  • Error Handling
  • Security

Intended Audience

  • Beginner Java developers
  • Java developers interested in learning how to Build and Deploy RESTful Web Services
  • Java Developers who want to develop web applications using the Spring framework
  • Java Developers who want to develop web applications with microservices
  • Java Developers who wish to develop Spring Boot Microservices with Spring Cloud

Prerequisites

  • Basic Java knowledge
Transcript

Hello, my friends. In this lesson, we will learn transaction tracking. Transaction tracking is essential in a distributed environment. In this lesson, we will inspect OpenTracing. It's implemented by MicroProfile-based microservice architectures. There are two main points when using OpenTracing. REST Services Traced Automatically without the need for an additional code or annotation. Only if you don't want a REST client not to trace in a tracing environment, you can use @Traced(false) Annotation. If you want to trace a non-REST class, you can use @Traced Annotation, as shown here. I'll demonstrate this with Quarkus. It's a framework that implements MicroProfiles similar to Open Liberty. I have forked a project from GitHub. It has organization and department services. We can use them to make GET and POST requests. There's a connection between organization and department.

For now, OpenTracing is not enabled in the project. To enable it, I'm going to add quarkus-smallrye-opentracing dependency to each project's POM file. Okay, added. And I need to add some main configuration parameters. I'm adding them for each service. I adjust service names by the service. We provided tracing capabilities to our services. Now, we will install collection and reporting server for our traces. We will install Jaeger tracing. It's part of the OpenTracing system. We will install it on Docker. So, we need to run a simple single line code. Here, we need to export some ports to reach them from local host. Okay, I started the tracing server. We can reach the tracing server page through a web server, writing localhost:16686. A page opened. You can see a search window here. For now, there is no service. Let's make some curl operations and then look again. First, I list the organizations. Okay, listed. And now, I will list the organizations with their departments.

Okay, listed. Now, let's open the tracing server webpage, make a refresh. As you see, some services have come now. Select organization service and press 'Find Traces.' On the right-hand side, you can see transactions. Transactions might have different span size. If you use only one REST service, then the span size is one. If you use multiple services, then the span size is greater than one. Here, the organization find all transaction has a span size of one and the organization with departments transaction has a span size of three. When you click on a transaction, you can see detailed information about that transaction, like how long it lasts, method, URL, etc. If we click on organization with departments transaction, we see three different spans. Different REST services spans are in different colors, as you see here. You can sort transactions by most recent, longest first, shortest first, most spans, and least spans. I think it really helps. Okay, friends, see you in the next lesson.

 

About the Author
Students
3888
Courses
64
Learning Paths
5

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.