Before reviewing this article, you need to deploy a Jaeger environment, as follows:
OpenTracing protocol
OpenTracing is a distributed tracking protocol that is independent of platform or language, with a unified interface, which is convenient for the development and access of different distributed tracking systems.Zipkin and Jaeger both follow the OpenTracing protocol。
Distributed tracking system Jaeger
Jaeger is a distributed tracking system developed by Uber that is already being used at scale at Uber. And joined the CNCF open source organization on September 13, 2017. Using Jaeger can visualize the call chain of the entire distributed system, which can easily identify and solve problems:
function
- Information dissemination in a distributed environment
- Distributed transaction monitoring
- Demonstrates cross-process call chains
- Performance optimization
- Locate the problem
characteristic
- The advantage of using UDP to transmit data compared to HTTP is that you don't have to worry about Jaeger service downtime or network transmission problems that affect normal business. The disadvantage is packet loss, which affects the entire call chain.
- The data is serialized via Thrift or protobuf (gRPC transmission), which is the default: Thrift.
Collection strategy
- ConstSampler, full collection
- ProbabilisticSampler, probability collection, default to 1 in 10,000
- RateLimitingSampler is a rate-limiting acquisition that can only collect a certain amount of data per second
- RemotelyControlledSampler is a dynamic collection strategy that adjusts the collection strategy according to the number of visits to the current system
ASP.NET Core is connected to Jaeger link tracing
The project is a framework for .NET Core 3.1, and Nuget installs the following packages:
Among them, OpenTracing.Contrib.NetCore provides the OpenTracing tool for .NET Core-based applications, which is simply an extension, and the main monitoring is as follows:
- ASP.NET Core
- Entity Framework Core
- System.Net.Http (HttpClient)
- System.Data.SqlClient
- Microsoft.Data.SqlClient
In the Startup file the ConfigureServices method is configured as follows:
Calling ITracer on the HomeController controller logs and time-consuming code is as follows:
Launch the website, visit the /Home/Index page, and then view the link through the online Jaeger UI to visit:http://127.0.0.1:16686/, you can search for prime by tags, as shown in the figure below:
http.url=http://localhost:27138/ As shown below:
Source code download:
Tourists, if you want to see the hidden content of this post, please Reply
Resources:
The hyperlink login is visible.
The hyperlink login is visible.
|