feat(tracing): Promote trace_lifecycle and ignore_spans to top-level options#6821
feat(tracing): Promote trace_lifecycle and ignore_spans to top-level options#6821ericapisani wants to merge 4 commits into
Conversation
…options Expose `trace_lifecycle` and `ignore_spans` as top-level `sentry_sdk.init()` parameters instead of requiring them under `_experiments`. The `_experiments` keys remain supported for backwards compatibility, but the top-level value now takes precedence: when both sources are set, `has_span_streaming_enabled` and `is_ignored_span` respect the top-level `trace_lifecycle` and fall back to `_experiments` only when it is unset. Add a validation warning when `ignore_spans` is set but span streaming is not enabled, since the option only takes effect in stream mode. Update the span-streaming docstrings to reference the new top-level configuration. Fixes PY-2609 Fixes #6820
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b96d65a. Configure here.
Codecov Results 📊✅ 91784 passed | ❌ 1 failed | ⏭️ 6302 skipped | Total: 98087 | Pass Rate: 93.57% | Execution Time: 304m 16s 📊 Comparison with Base Branch
➕ New Tests (1)View new tests
❌ Failed Tests
|
An explicit top-level ignore_spans=[] was treated as unset, letting _experiments rules leak through. Use an is-not-None check so top-level config wins whenever provided, including an empty list meant to disable ignoring.

Expose
trace_lifecycleandignore_spansas top-levelsentry_sdk.init()parameters instead of requiring them under
_experiments. The_experimentskeys remain supported for backwards compatibility, but thetop-level value now takes precedence: when both sources are set,
has_span_streaming_enabledandis_ignored_spanrespect the top-leveltrace_lifecycleand fall back to_experimentsonly when it is unset.Add a validation warning when
ignore_spansis set but span streaming isnot enabled, since the option only takes effect in stream mode. Update the
span-streaming docstrings to reference the new top-level configuration.
Fixes PY-2609
Fixes #6820