diff --git a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs index 91ea911..8127ba8 100644 --- a/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs +++ b/src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSTracingPipelineHandler.cs @@ -24,6 +24,8 @@ internal sealed class AWSTracingPipelineHandler : PipelineHandler private static readonly ActivitySource AWSSDKActivitySource = new(ActivitySourceName, typeof(AWSTracingPipelineHandler).Assembly.GetPackageVersion()); + private readonly AsyncLocal activity = new(); + private readonly AWSClientInstrumentationOptions options; public AWSTracingPipelineHandler(AWSClientInstrumentationOptions options) @@ -31,7 +33,11 @@ public AWSTracingPipelineHandler(AWSClientInstrumentationOptions options) this.options = options; } - public Activity? Activity { get; private set; } + public Activity? Activity + { + get => this.activity.Value; + private set => this.activity.Value = value; + } public override void InvokeSync(IExecutionContext executionContext) {