Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.07 KB

File metadata and controls

53 lines (39 loc) · 2.07 KB

Tracing with AWS Distro for OpenTelemetry .Net SDK

Status
Stability Stable
Code Owners @srprash, @normj

NuGet version badge NuGet download count badge codecov.io

If you want to send the traces to AWS X-Ray, you can do so by using AWS Distro with the OpenTelemetry SDK.

Getting Started

The OpenTelemetry SDK generates traces with W3C random ID which X-Ray backend doesn't currently support. You need to install the OpenTelemetry.Extensions.AWS to be able to use the AWS X-Ray id generator which generates X-Ray compatible trace IDs. If you plan to call another application instrumented with AWS X-Ray SDK, you'll need to configure the AWS X-Ray propagator as well.

dotnet add package OpenTelemetry.Extensions.AWS

Usage

AWS X-Ray Id Generator and Propagator

Configure AWS X-Ray ID generator and propagator globally in your application as follows. Make sure to call AddXRayTraceId() in the very beginning when creating TracerProvider.

using OpenTelemetry;
using OpenTelemetry.Extensions.AWS.Trace;
using OpenTelemetry.Trace;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
                        .AddXRayTraceId()
                        // other instrumentations
                        ...
                        .Build();

Sdk.SetDefaultTextMapPropagator(new AWSXRayPropagator());

References