Jaeger Tracing là gì
Jaeger distributed tracing - complete guideDecember 1, 2021 · 8 min read Ankit Anand SigNoz TeamDistributed tracing has become critical for application performance monitoring in microservice-based architecture. Jaeger is a popular open-source tool used for distributed tracing. With distributed tracing, engineering teams get a central overview of how user requests perform across multiple services. Show
What is Jaeger?Jaeger is an open-source distributed tracing tool meant to monitor and troubleshoot transactions in distributed systems. It was built by teams at Uber and then open-sourced in 2015. Jaeger is also a Cloud Native Computing Foundation graduate project. In a microservice architecture, you can use Jaeger to track transactions across multiple services. The process of tracking transactions across different services is called distributed tracing.
What is distributed tracing?In the world of microservices, a user request travels through hundreds of services before serving a user what they need. To make a business scalable, engineering teams are responsible for particular services with no insight into how the system performs as a whole. And that's where distributed tracing comes into the picture. Microservice architecture of a fictional e-commerce applicationDistributed tracing gives you insight into how a particular service is performing as part of the whole in a distributed software system. There are two essential concepts involved in distributed tracing: Spans and trace context. User requests are broken down into spans.
A trace context is passed along when requests travel between services, which tracks a user request across services. Thus, you can see how a user request performs across services and identify what exactly needs your attention without manually shifting through multiple dashboards. A trace context is passed when user requests pass from one service to anotherHow does Jaeger accomplish distributed tracing?There are four key components to a distributed tracing tool. These components together capture transactions into spans and then correlate those spans to form a trace. The four key components of a distributed tracing tool are:
Let us see in detail what these components are and how these components come together to monitor a microservice architecture. InstrumentationWhat is instrumentation? Instrumentation is the process of generating telemetry data(logs, metrics, and traces) from your application code. It is essentially writing code that enables your application code to emit telemetry data, which can be used later to investigate issues. Most distributed tracing tools offer clients libraries, agents, and SDKs to instrument application code. Jaeger's client libraries for instrumentation are based on OpenTracing APIs. OpenTracing was an open-source project aimed at providing vendor-neutral APIs and instrumentation for distributed tracing. It later got merged into OpenTelemetry. Jaeger has official client libraries in the following languages:
When a service is instrumented, it generates spans for incoming transactions and attaches trace context to outgoing transactions. Data pipelineOnce the trace data is collected with the help of client libraries, it can be directly sent to the storage backends for storage and visualization. But it's a good practice to have a tracing pipeline for data buffering as the application scales. The pipeline enables receiving data in multiple formats, manipulation, batching, indexing, and queueing. Jaeger provides Jaeger collectors, as seen in the architecture diagram. The collectors validate traces, index them and perform any transformation before storing the trace data. Backend StorageJaeger ships with simple in-memory storage for testing setups. Jaeger supports two popular open-source NoSQL databases as trace storage backends:
Web UI/VisualizationJaeger's UI is basic but comprehensive when it comes to distributed tracing. Implementing distributed tracing in Jaeger - Sample AppSample HotRod applicationThe sample HotRod application is a demo ride-sharing application. It shows four locations and by clicking on a location you call a ride to that location. HotRod application webUIThe sample HotRod application is a demo ride-sharing application. It shows four locations, and by clicking on a location, you call a ride to that location. Steps to get started with Jaeger distributed tracingIn order to see how Jaeger is used for distributed tracing, let's run the demo application HotRod and see its traces using Jaeger. Steps to run HotRod application with Jaeger:
To see traces on Jaeger, we need to generate some load. Click on different locations a number of times. When you access the Jaeger UI now, you can find the list of services along with its trace captured on Jaeger. List of services of HotRod application reported on Jaeger dashboardJaeger also creates a dependency diagram by tracing how requests flow and shows it in the dashboard. From the dependency diagram, we can see that the HotRod application has four microservices and two databases. Jaeger shows a dependency diagram mapping your servicesLimitations of using Jaeger as a distributed tracing toolJaeger is a preferred choice when it comes to distributed tracing. But engineering teams need more than traces to resolve issues quickly. They need access to both metrics and traces. Metrics such as response times, error rates, request rates, and CPU usage are equally important to understand application performance. A few key challenges of using Jaeger as a distributed tracing tool are as follows:
For a fast-moving engineering team, you need dashboards that can drive quick insights and resolution. And that's where SigNoz comes into the picture. It is a great alternative to Jaeger for distributed tracing in microservices. SigNoz - a Jaeger alternative for distributed tracingSigNoz is a full-stack open-source application performance monitoring and observability tool which can be used in place of Jaeger. SigNoz is built to support OpenTelemetry natively. OpenTelemetry is becoming the world standard to generate and maintain telemetry data(Logs, metrics, and traces). SigNoz can be used as a distributed tracing tool for a microservice architecture. SigNoz also provides users flexibility in terms of data storage.You can choose between ClickHouse or Kafka + Druid as your backend storage while installing SigNoz. Both are industry-proven and highly scalable databases. Architecture of SigNoz with ClickHouse as storage backend and OpenTelemetry for code instrumentatiionSigNoz comes with out of box visualization of things like RED metrics. SigNoz UI showing application overview metrics like RPS, 50th/90th/99th Percentile latencies, and Error RateYou can also use flamegraphs to visualize spans from your trace data. All of this comes out of the box with SigNoz. Flamegraphs showing exact duration taken by each spans - a concept of distributed tracingSome of the things SigNoz can help you track:
You can check out SigNoz's GitHub repo here Related ContentUsing Jaeger for your microservices Tags:
|