# Video

# Distributed Tracing

In the Kubernetes/OpenShift world, the de-facto standard for distributed tracing through microservices is OpenTracing (opens new window) and Jaeger (opens new window). Jaeger and OpenTracing are available as libraries for ASP.NET applications as well.

  1. Install the OpenTracing package
    cd <solution root>/src/RedHat.TodoList
    dotnet add package OpenTracing.Contrib.NetCore
    dotnet add package Jaeger.Core
  2. Enable OpenTracing in your Startup.cs file as follows:
       public void ConfigureServices(IServiceCollection services)
          // Add framework services.
          // Adds the Jaeger Tracer.
          services.AddSingleton<ITracer>(serviceProvider =>
             string serviceName = serviceProvider.GetRequiredService<IWebHostEnvironment>().ApplicationName;
             // This will log to a default localhost installation of Jaeger.
             var tracer = new Tracer.Builder(serviceName)
                .WithSampler(new ConstSampler(true))
             // Allows code that can't use DI to also access the tracer.
             return tracer;
  3. Now, you can use Environment Variables or settings in appsettings.json to configure (opens new window) where to send the tracing data
Last Updated: 9/2/2023, 4:02:00 PM