Using distributed tracing
If errors happen on the service, where is this request coming from, and from where does it originate? With distributed tracing, we can see the interaction of services and resources and can easily follow information on how requests from a client flow to the different services and see when errors occur, going from the error up to the stack.
Using .NET, we use ActivitySource
and Activity
classes to specify information for distributed tracing.
Creating an ActivitySource class with the DIC
When writing trace information, you’ll usually have one ActivitySource
class in a project that’s used by all classes that write trace information. With the games client library, an ActivitySource
class is used as a static member. Using an ActivitySource
class from an executable project such as the games API, we can register this in the DIC:
Codebreaker.GameAPIs/ApplicationServices.cs
public static void AddApplicationTelemetry(this IhostApplicationBuilder...