Tracing

This page contains documentation for OpenTelemetry .NET.

Note: OpenTelemetry .NET is in alpha and should not be deployed to production systems.

Quick Start

  1. Install OpenTelemetry via NuGet along with an exporter such as Zipkin or Jaeger.
  2. Create a Tracer through the TracerFactory, as shown:
var tracerFactory = TracerFactory.Create(
                                  builder => builder.AddProcessorPipeline(
                                  c => c.SetExporter(new JaegerTraceExporter(jaegerOptions))));
  1. Get a reference to your Tracer from the TracerFactory using the GetTracer() method.
  2. Start a span, then add attributes or events to it as desired, as seen here:
using (tracer.StartActiveSpan("test", out var span))
{
  span.SetAttribute("custom-attribute", 219);
  span.AddEvent("hello world");
}
// the span will automatically complete when it goes out of scope here.

You can find more exporters and examples of how to use them here.

See the README for the most up-to-date information on configuring and using OpenTelemetry .NET.

API Reference

Please see the GitHub Repository for more information on the API.