Skip to content

Commit f55a39e

Browse files
committed
avoid overwriting _dd.p.dm tag
1 parent 70c37c8 commit f55a39e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ddtrace/internal/sampling.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ def is_single_span_sampled(span):
267267

268268
def _set_sampling_tags(span, sampled, sample_rate, mechanism):
269269
# type: (Span, bool, float, int) -> None
270-
# Set the sampling mechanism
271-
set_sampling_decision_maker(span.context, mechanism)
270+
# Set the sampling mechanism once but never overwrite an existing tag
271+
if not span.context._meta.get(SAMPLING_DECISION_TRACE_TAG_KEY):
272+
set_sampling_decision_maker(span.context, mechanism)
273+
272274
# Set the sampling psr rate
273275
if mechanism in (
274276
SamplingMechanism.LOCAL_USER_TRACE_SAMPLING_RULE,

0 commit comments

Comments
 (0)