OpenTelemetry for .NET supports a wide range of automatic and manual instrumentation options, helping you capture spans, metrics, and logs with minimal effort.
Auto-instrumentation lets you automatically trace common libraries such as HTTP clients, database drivers, and more without needing to modify your code. OpenTelemetry provides auto-instrumentation libraries for many popular languages, making it fast to get started with tracing.For .NET, you can automatically instrument supported libraries like ASP.NET Core, HTTP clients, and more.Typically, you configure it in your Program.cs:
Manual instrumentation gives you full control over your traces, allowing you to create spans wherever needed. You can customize span names, attributes, and relationships to capture the most important parts of your application’s flow.You can manually create and manage spans in .NET using the OpenTelemetry APIs:
Copy
Ask AI
var tracer = tracerProvider.GetTracer("my-service");using (var span = tracer.StartActiveSpan("my-operation")) { // your application logic }
Once your application is instrumented, you need to export telemetry data. PlayerZero supports the OpenTelemetry Protocol (OTLP) over HTTP. You can configure your OpenTelemetry SDK to export traces, logs, and metrics to PlayerZero’s endpoint by setting the endpoint URL and API token.For .NET applications, configure the OTLP exporter:Key environment variables:
Using an OpenTelemetry Collector is optional for most setups. A collector can help route telemetry to multiple destinations, perform transformations, or batch data efficiently. You might use a collector if you want to forward telemetry to both PlayerZero and another observability platform simultaneously.You can forward your telemetry through an OpenTelemetry Collector to enrich, filter, or route spans before reaching PlayerZero.