Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 2.5 KB

File metadata and controls

46 lines (39 loc) · 2.5 KB

SignalFx Tracing OpenTracing for .NET

This folder contains a .NET solution SignalFx.Tracing.Samples.sln with the following example projects:

These projects demonstrates how to use the SignalFx.Tracing.OpenTracing and the OpenTracing NuGet packages to manually instrument .NET applications and libraries.

Recommendations for .NET Manual Instrumention

  • The manual instrumentation code should use only OpenTracing constructs. The benefit of this approach is that if later, the application is deployed with auto-instrumentation enabled traces will keep the manually added spans and will be enriched with more spans added by the auto-instrumentation.
  • Use the OpenTracing semantic conventions especially use the error tag with value true in case of exceptions and errors.
  • Libraries should use only constructs from OpenTracing and don't need to directly reference the SignalFx.Tracing.OpenTracing NuGet Package.
  • Applications need to reference SignalFx.Tracing.Tracer.Instance to ensure that the Tracer runs the auto-configuration and registers itself as the OpenTracing.Utils.GlobalTrace.Instance. Example:
    internal static class Program
    {
        internal static void Main(string[] args)
        {
            var signalFxTracer = Tracer.Instance;
            signalFxTracer.Settings.ServiceName = "OpenTracing.Manually.Instrumented.App";
            using var instrumentedSample = new InstrumentedSample();
            instrumentedSample.Start();
            Console.WriteLine("Sample is running on the background, press ENTER to stop");
            Console.ReadLine();
            Console.WriteLine("Shutting down...");
        }
    }

Other Links

OpenTracing Examples