Skip to content

ref: Add support for custom sampling context to span first (14)#5628

Merged
sentrivana merged 96 commits into
masterfrom
ivana/span-first-14-custom-sampling-context
Mar 11, 2026
Merged

ref: Add support for custom sampling context to span first (14)#5628
sentrivana merged 96 commits into
masterfrom
ivana/span-first-14-custom-sampling-context

span_context

3142247
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
GitHub Actions / warden: find-bugs completed Mar 11, 2026 in 3m 46s

1 issue

find-bugs: Found 1 issue (1 low)

Low

Custom sampling context can overwrite span_context - `sentry_sdk/tracing_utils.py:1434`

The sampling_context.update(propagation_context.custom_sampling_context) call on line 1434 can overwrite the SDK-constructed span_context key if a user or integration provides custom_sampling_context containing a span_context key. This could lead to loss of span information (name, trace_id, parent_span_id, parent_sampled, attributes) in the traces_sampler callback, potentially causing incorrect sampling decisions.


Duration: 3m 43s · Tokens: 1.3M in / 8.4k out · Cost: $3.35 (+extraction: $0.00, +fix_gate: $0.00)