diff --git a/src/OpenTelemetry/Trace/TracerProviderSdk.cs b/src/OpenTelemetry/Trace/TracerProviderSdk.cs index c269c08988e..f7dc66e2ede 100644 --- a/src/OpenTelemetry/Trace/TracerProviderSdk.cs +++ b/src/OpenTelemetry/Trace/TracerProviderSdk.cs @@ -112,7 +112,7 @@ internal TracerProviderSdk( else if (sampler is AlwaysOffSampler) { listener.Sample = (ref ActivityCreationOptions options) => - !Sdk.SuppressInstrumentation ? PropagateOrIgnoreData(options.Parent.TraceId) : ActivitySamplingResult.None; + !Sdk.SuppressInstrumentation ? ActivitySamplingResult.PropagationData : ActivitySamplingResult.None; } else { @@ -287,23 +287,9 @@ private static ActivitySamplingResult ComputeActivitySamplingResult( { options.SamplingTags.Add(att.Key, att.Value); } - - return activitySamplingResult; } - return PropagateOrIgnoreData(options.Parent.TraceId); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ActivitySamplingResult PropagateOrIgnoreData(ActivityTraceId traceId) - { - var isRootSpan = traceId == default; - - // If it is the root span select PropagationData so the trace ID is preserved - // even if no activity of the trace is recorded (sampled per OpenTelemetry parlance). - return isRootSpan - ? ActivitySamplingResult.PropagationData - : ActivitySamplingResult.None; + return activitySamplingResult; } } }