Telemetry consists of transparently collecting usage data from software over the internet. It can be very helpful in the sense that all your applications are monitored centrally, and telemetry packages usually supply handy tools, such as rich user interfaces for selecting exactly what we want to see, or creating alarms. There are a few alternatives, and we will only touch on a few of the most popular ones in the following sections.
Using trace identifiers
ASP.NET Core provides anIHttpRequestIdentifierFeature feature that generates a unique ID per each request. This ID may help you correlate events that happen in the context of a request. Here are three ways to get this ID:
//using the TraceIdentifier property in ASP.NET Core 2.x
var id1 = this.HttpContext.TraceIdentifier;
//accessing the feature in earlier versions of ASP.NET Core
var id2 = this.HttpContext.Features.Get<IHttpRequestIdentifierFeature>().TraceIdentifier;
//another way
var...