From ad55a5e7e4f35802f6106d541b1bcd1f014f109d Mon Sep 17 00:00:00 2001 From: Edwin Smith Date: Tue, 2 Jul 2024 09:14:10 -0400 Subject: [PATCH] candidate fix for issue 150 --- src/span_ext.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/span_ext.rs b/src/span_ext.rs index b7d0454..9e55714 100644 --- a/src/span_ext.rs +++ b/src/span_ext.rs @@ -142,6 +142,9 @@ impl OpenTelemetrySpanExt for tracing::Span { if let Some(get_context) = subscriber.downcast_ref::() { get_context.with_context(subscriber, id, move |data, _tracer| { if let Some(cx) = cx.take() { + // Clear latched sampling_result so it will recompute from + // the new parent_cx after changing parents. + data.builder.sampling_result = None; data.parent_cx = cx; } });