Repository navigation
feat(sentry)!: support sentry-sdk 3 alongside 2.x and raise the floor to 2.70 - #359
Merged
Merged
Conversation
This was referenced Oct 29, 2026
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.
Closes #306.
lite-bootstrap now runs on sentry-sdk 2.70 and later, on both majors. The
sentryextra changes from three marker-split>=2.1/2.11/2.59,!=2.69.0,<3lines tosentry-sdk>=2.70,<4.Changes
IS_SENTRY_SDK_2replaces theinspect.signatureprobe. 2.x getslevel=breadcrumb_level, sentry_logs_level=None, as before. 3.x getsbreadcrumb_level=breadcrumb_level, event_level=logging.ERROR, level=None, because on 3.xlevelmeans Sentry Logs andevent_leveldefaults toNone. The two dicts are one conditional expression, so line coverage reaches 100% on either major.data_collection.DEFAULT_DATA_COLLECTIONis the migration guide's dict for matchingsend_default_pii=False, plus"stack_frame_variables": {"mode": "denylist"}. It is passed on both majors. A user's owndata_collectioninsentry_additional_paramsstill replaces it.logentry["formatted"], which 2.70 and 3.x both fill.sentry-majorsjob runs the full suite onsentry-sdk<3and onsentry-sdk==3.0.0b2. The pytest jobs keep resolving the newest stable release, so after GA they test 3.x, and this job still covers 2.x. Replace the3.0.0b2pin with the GA release once it ships.configuration.mdcovers the integration on both majors, and a new "Sentry data collection" section says what is collected. It also says that 3.0 raisesTypeErrorfor removed options passed throughsentry_additional_params.Departures from the issue
trace_lifecycle, and it removed options the issue doesn't list (enable_metrics,stream_gen_ai_spans,trace_ignore_status_codes). The docs therefore name a few removed options and link the migration guide instead of copying a list that is still changing.INFOand anERRORlog produce exactly one envelope item, anevent) fails if the integration is missing, and the existingsentry_default_integrations=Falsetest runs on both majors in the new job.formatted/messageparametrized tests are deleted entirely. With themessagecase gone,test_drops_event_on_skip_sentry_before_message_checkandtest_modify_lifts_message_and_attaches_extraalready cover what was left.Tests
Written first, against main's code:
test_sentry_bootstrap_turns_error_logs_into_events_and_sends_no_sentry_logs: on 3.0.0b2 it got alogitem and noevent.test_sentry_filters_secret_stack_frame_variables: failed on both majors. On 2.73, the defaultEventScrubbermatches exact key names, so a local namedapi_tokenreached Sentry in clear. On 3.0, locals aren't scrubbed at all. Thedata_collectiondenylist matches substrings, so it catches both.test_sentry_collects_no_user_info_or_http_bodies_by_default: failed on both majors, because 2.73 resolveshttp_bodiesto all body types whendata_collectionisn't passed.test_sentry_additional_params_data_collection_replaces_the_defaultMain's suite on 3.0.0b2 had 6 failures. This branch passes all 454 tests at 100% coverage on 2.70.0, 2.73.0 and 3.0.0b2.
just lint,just adr-check,just docs-buildand lychee pass.Breaking changes
EventScrubberno longer runs, because sentry-sdk skips it wheneverdata_collectionis set. Filtering now comes fromdata_collection: denylist matching on headers, cookies, query parameters and frame variables.send_default_pii=Trueinsentry_additional_paramshas no effect on 2.x, becausedata_collectionwins. On 3.x it raisesTypeError. To collect more, passdata_collectioninstead, for example{**DEFAULT_DATA_COLLECTION, "user_info": True}.Benchmarks
benchmarks/used 2.x-only APIs, so after GA the lint job would have failed there. The second commit makes the scripts type-check and run on both majors.LoggingIntegrationper major.NoOpSpan, so the per-requestTransactioncost that ASGI integrations build and discard a Transaction per request when tracing is disabled (~34 µs) getsentry/sentry-python#7400 measures doesn't exist there. The parts that probe that cost stay 2.x-only:*_skip_txnanderrors_only_lazy_sample_randpatcheserrors_only_txn_endpoint_style, because 3.x has notransaction_stylerepro_sentry_txn.py --patched, which exits with a message on 3.xmicro.pytimescontinue_traceand the rootstart_spaninstead.Any-typed handles (importlib.import_module,setattr), sotypasses against either major.ty checkpasses against 2.73.0 and 3.0.0b2. On both majors I ranrun.py(sentry and stack suites),verify.py,micro.py,repro_sentry_txn.pyandprofile_one.pywith small request counts, checking only that they run. I didn't runrun_http.py, which needsab. Its only Sentry dependency is the scenario names it validates, and those are the same onesrun.pyexercised.