fix: Use strict trace continuation for `continue_from_span` by szokeasaurusrex · Pull Request #1329 · getsentry/sentry-rust · GitHub
Skip to content

fix: Use strict trace continuation for continue_from_span - #1329

Open
szokeasaurusrex wants to merge 1 commit into
szokeasuarusrex/deprecate-sample_should_sendfrom
szokeasaurusrex/continue_from_span-strict
Open

szokeasaurusrex wants to merge 1 commit into
szokeasuarusrex/deprecate-sample_should_sendfrom
szokeasaurusrex/continue_from_span-strict

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

The function continue_from_span allows continuing a distributed trace from a span that is spawned on another thread.

Typically, both spans in this case are from the same Client, but if they are attached to different Clients it is also possible that they are associated with different org IDs.

Anyways, to keep the handling of distributed traces consistent, it makes sense to populate incoming_trace in the continue_from_span method. As we will be adding more things to IncomingTrace, we should be using it consistently.

@szokeasaurusrex
szokeasaurusrex added this pull request to stack #1332 September 22, 2026 13:39
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/continue_from_span-strict branch from aff7363 to 35a2cee Compare September 22, 2026 13:45
Comment on lines +274 to +283

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here look more complicated than they really are; we needed to refactor the tuple used in the match statement to a named structure as incoming_trace is only available under the "client" feature.

Any other solution I could think of was more complicated

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/continue_from_span-strict branch from 35a2cee to 87541ba Compare September 22, 2026 13:49
@szokeasaurusrex
szokeasaurusrex marked this pull request as ready for review September 22, 2026 13:49
@szokeasaurusrex
szokeasaurusrex requested a review from a team as a code owner September 22, 2026 13:49
cursor[bot]

This comment was marked as resolved.

Comment thread sentry-core/src/performance/mod.rs
@szokeasaurusrex
szokeasaurusrex marked this pull request as draft September 22, 2026 13:53
The function `continue_from_span` allows continuing a distributed trace from a span that is spawned on another thread.

Typically, both spans in this case are from the same Client, but if they are attached to different Clients it is also possible that they are associated with different org IDs.

Anyways, to keep the handling of distributed traces consistent, it makes sense to populate `incoming_trace` in the `continue_from_span` method. As we will be adding more things to `IncomingTrace`, we should be using it consistently.
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/continue_from_span-strict branch from 87541ba to 5c329fe Compare September 22, 2026 13:57
@szokeasaurusrex
szokeasaurusrex marked this pull request as ready for review September 22, 2026 13:57
@giortzisg

Copy link
Copy Markdown
Contributor

Is there a reason we introduce an IncomingSpanData struct instead of storing the information in the already existing TracePropagationContext?

@szokeasaurusrex

szokeasaurusrex commented Sep 24, 2026 •

Copy link
Copy Markdown
Member Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants