feat: Implement strict trace continuation#2872
Merged
sl0thentr0py merged 4 commits intomasterfrom Mar 4, 2026
Merged
Conversation
dingsdax
reviewed
Feb 27, 2026
Add support for org_id extraction from DSN and strict trace continuation to control whether the SDK continues traces from third-party services. Changes: - Extract org_id from DSN host (e.g., "o123.ingest.sentry.io" -> "123") - Add `org_id` config option to explicitly set the organization ID - Add `strict_trace_continuation` boolean config option (default: false) - Propagate org_id in baggage as `sentry-org_id` - Validate incoming trace org_id against SDK org_id per decision matrix - Add comprehensive tests for all scenarios Closes #2865 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test DSN uses o447951.ingest.sentry.io, so the new org_id propagation correctly adds sentry-org_id=447951 to baggage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3f16ad3 to
5d40252
Compare
sl0thentr0py
approved these changes
Mar 4, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the
strict_trace_continuationfeature for the Sentry Ruby SDK. This controls whether the SDK continues traces from unknown third-party services that happen to be instrumented by Sentry.Changes
o123.ingest.sentry.io->"123") using theORG_ID_REGEXpatternorg_idconfig option: An explicit setting that takes precedence over DSN parsing (useful for self-hosted/Relay setups)strict_trace_continuationconfig option: Boolean, defaultfalse. Controls trace continuation behaviorsentry-org_idin outgoing baggage (both fromPropagationContextandTransactionhead baggage)sentry-org_idbaggage against the SDK's own org ID per the decision matrixDecision Matrix
Files Modified
sentry-ruby/lib/sentry/dsn.rb- org_id extraction from DSN hostsentry-ruby/lib/sentry/configuration.rb-org_id,strict_trace_continuation,effective_org_idsentry-ruby/lib/sentry/propagation_context.rb-should_continue_trace?validation + org_id in head baggagesentry-ruby/lib/sentry/transaction.rb- org_id in head baggagesentry-ruby/spec/sentry/dsn_spec.rb- Tests for org_id parsing and overridesentry-ruby/spec/sentry/propagation_context_spec.rb- Tests for full decision matrixReference Implementations
Closes #2865
🤖 Generated with Claude Code