René's URL Explorer Experiment


Title: ref: Flush trace buckets when segment spans finish by alexander-alderman-webb · Pull Request #7170 · getsentry/sentry-python · GitHub

Open Graph Title: ref: Flush trace buckets when segment spans finish by alexander-alderman-webb · Pull Request #7170 · getsentry/sentry-python

X Title: ref: Flush trace buckets when segment spans finish by alexander-alderman-webb · Pull Request #7170 · getsentry/sentry-python

Description: Description Mark the corresponding bucket as pending in the span buffer when a segment span is added. This aims to keep memory pressure low. Segment spans typically finish after their children. There may be multiple segments in a trace, and flushing more frequently leads to more outbound network requests in these cases. Adapt span batcher tests by adding an outer segment in most tests. As a result, the various flush conditions are still exercised as the assertions run before the segment span has finished (finishing the segment span otherwise flushes the buffer as well). The tests that exercise multiple buckets are changed to use traces.new_trace() in combination with a segment span that's left open Without changes to the sentry_init fixture, tests fail on free-threading. This is because the background flusher collects pending items before sentry_sdk.flush() can synchronously flush all everything. The background flush is asynchronous and creates a race conditions. Issues Reminders Please add tests to validate your changes, and lint your code using uv run ruff. Add GH Issue ID & Linear ID (if applicable) PR title should use conventional commit style (feat:, fix:, ref:, meta:) For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community

Open Graph Description: Description Mark the corresponding bucket as pending in the span buffer when a segment span is added. This aims to keep memory pressure low. Segment spans typically finish after their children. Th...

X Description: Description Mark the corresponding bucket as pending in the span buffer when a segment span is added. This aims to keep memory pressure low. Segment spans typically finish after their children. Th...

Opengraph URL: https://github.com/getsentry/sentry-python/pull/7170

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6e26c181-8ae3-b1b6-da95-1fc5e31bed60
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBC10:11EACE:BB64BB:FB1793:6B00F6BD
html-safe-nonce6062eef27ffc00d314a534ec4281ab4e97f12e0b866ba9bdd95b8d919835fc73
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzEwOjExRUFDRTpCQjY0QkI6RkIxNzkzOjZCMDBGNkJEIiwidmlzaXRvcl9pZCI6Ijc1ODcxODg3NTk1ODY3MzE3MDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9daffeca778060b6a6661d870e9405de418990374fde2ff1633f604f646eacc8
hovercard-subject-tagpull_request:4252844691
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-python/pull/7170/files
twitter:imagehttps://avatars.githubusercontent.com/u/224035503?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224035503?s=400&v=4
og:image:altDescription Mark the corresponding bucket as pending in the span buffer when a segment span is added. This aims to keep memory pressure low. Segment spans typically finish after their children. Th...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/7170/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F7170%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F7170%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/pull/7170/files
Reloadhttps://github.com/getsentry/sentry-python/pull/7170/files
Reloadhttps://github.com/getsentry/sentry-python/pull/7170/files
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues345 (345)https://github.com/getsentry/sentry-python/issues
Pull requests42 (42)https://github.com/getsentry/sentry-python/pulls
Discussionshttps://github.com/getsentry/sentry-python/discussions
Actionshttps://github.com/getsentry/sentry-python/actions
Security and quality2 (2)https://github.com/getsentry/sentry-python/security
Insightshttps://github.com/getsentry/sentry-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
alexander-alderman-webbhttps://github.com/alexander-alderman-webb
masterhttps://github.com/getsentry/sentry-python/tree/master
webb/flush-segment-bucketshttps://github.com/getsentry/sentry-python/tree/webb/flush-segment-buckets
Conversation 8 https://github.com/getsentry/sentry-python/pull/7170
Commits 22 https://github.com/getsentry/sentry-python/pull/7170/commits
Checks 144 https://github.com/getsentry/sentry-python/pull/7170/checks
Files changed https://github.com/getsentry/sentry-python/pull/7170/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
ref: Flush trace buckets when segment spans finish https://github.com/getsentry/sentry-python/pull/7170/files#top
Show all changes 22 commits https://github.com/getsentry/sentry-python/pull/7170/files
0414de5 Revert "fix(batcher): Add global flush trigger based on the span numb… alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/0414de55921f2c481338136aeb89091879419ae3
dd57e21 Revert "feat(batcher): Add global flush trigger based on summed size … alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/dd57e21e763889cff0367efaa1b9a8fdab23a6e2
8669777 Revert "feat(batcher): Add hard span limit (#7143)" alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/8669777b18ce37bb1b52530fafb4953175f8dfa9
46cf5ce ref: Flush trace bucket when segment span finishes alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/46cf5ce0214dc09433a94d57f8e9779ebde84d25
51a768e make mypy happy alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/51a768e97985e15159e4f04a1cf74c58eeded96b
379b8c4 simplify and fix tests alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/379b8c4effc32bb4b751f63d3096c1d9ed074952
9241cee . alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/9241cee48aa069eb691ab8d00098e1d2752e0078
b3da36f add span to pending bucket alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/b3da36f149264fa35ae33a4177a86068ebf768a6
7652579 modify pending flush inside lock alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/76525790a18035dc1c231a30a535feee02c5b2ee
78b2893 flush async alexander-alderman-webb Aug 11, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/78b2893fba8b3cba1a6c0bc6d446181c5da7bd21
0478e71 fix race on 3.14t alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/0478e7188ea3350f6038a18067d7b90b274f1b60
602a412 clean up comments alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/602a4129e51768161b490ce17e7d1cfa7433a2b2
bd5a977 conftest update alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/bd5a977d0d5976d43e11e1dd42418db57905eb54
02c0a67 work on fixture changes alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/02c0a678680245618e4c9f7f881fc5071fceac1c
8057cac add re-entrancy guard alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/8057cac2b0e9ca11f17e27922142f4191bd949fd
5653f6c edit comment alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/5653f6c0919b76c562b2e88027dff95caaad76ad
5ee9fb6 resolve django test failures alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/5ee9fb6325790f1c3bf9ded94a068e43d06ec415
40dfb01 second iteration django tests alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/40dfb01b5db345c8638f7f7496f1c33e7fee8bdd
c29c865 resolve flask test failures alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/c29c865b5ee0e9de276922797043a24303f6af56
14d342d resolve common test failures alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/14d342dce7e7da8deb9f3a6ec85b07119daeef58
e0150a4 merge master alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/e0150a4d8dbf0cf8abccbc6d964b147491fadba3
54334a3 clean up comment alexander-alderman-webb Aug 12, 2026 https://github.com/getsentry/sentry-python/pull/7170/commits/54334a33205b1f197b18ef487b1fc612ef6a16ad
Clear filters https://github.com/getsentry/sentry-python/pull/7170/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
_span_batcher.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-f400f2b5275be953a87e1a2fa25659221ab46d1f696f7d1104694c55ea621189
conftest.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
test_basic.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-18f1bd8241119d62eddf36e6bf69d0f29bd8968bf2aca21d9d6238040c60189b
test_cache_module.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-c1f33e78b1097a7bf798677671ca8e96a19673afcac6faa0c7637e2f953f6fee
test_flask.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-01db75b6a9e974a9450a181c711ba26dbff2f28520e7c4ff2044fbf0efa8af7d
test_span_batcher.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-770f63c0b84ba5cc921a4cde924003962d60143916fb5eab5e8b901f6f25458d
test_span_streaming.py https://github.com/getsentry/sentry-python/pull/7170/files#diff-e2e61cb0ef656c44ac2595edfd38baa79c29327254e95505cba4e2aa9fcfa514
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/_span_batcher.pyhttps://github.com/getsentry/sentry-python/pull/7170/files#diff-f400f2b5275be953a87e1a2fa25659221ab46d1f696f7d1104694c55ea621189
View file https://github.com/getsentry/sentry-python/blob/54334a33205b1f197b18ef487b1fc612ef6a16ad/sentry_sdk/_span_batcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/7170/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/7170/files#diff-f400f2b5275be953a87e1a2fa25659221ab46d1f696f7d1104694c55ea621189
https://github.com/getsentry/sentry-python/pull/7170/files#diff-f400f2b5275be953a87e1a2fa25659221ab46d1f696f7d1104694c55ea621189
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
tests/conftest.pyhttps://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
View file https://github.com/getsentry/sentry-python/blob/54334a33205b1f197b18ef487b1fc612ef6a16ad/tests/conftest.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/7170/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
https://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
https://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
ericapisanihttps://github.com/ericapisani
Aug 12, 2026https://github.com/getsentry/sentry-python/pull/7170/files#r3766725881
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
alexander-alderman-webbhttps://github.com/alexander-alderman-webb
Aug 12, 2026https://github.com/getsentry/sentry-python/pull/7170/files#r3767075659
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
sentry-python/sentry_sdk/_span_batcher.pyhttps://github.com/getsentry/sentry-python/blob/4e4ea83b4fafaae3d53e68d756c55c74fee37545/sentry_sdk/_span_batcher.py#L94
4e4ea83https://github.com/getsentry/sentry-python/commit/4e4ea83b4fafaae3d53e68d756c55c74fee37545
sentry-python/sentry_sdk/client.pyhttps://github.com/getsentry/sentry-python/blob/4e4ea83b4fafaae3d53e68d756c55c74fee37545/sentry_sdk/client.py#L1381
4e4ea83https://github.com/getsentry/sentry-python/commit/4e4ea83b4fafaae3d53e68d756c55c74fee37545
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
https://github.com/getsentry/sentry-python/pull/7170/files#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
tests/integrations/django/test_basic.pyhttps://github.com/getsentry/sentry-python/pull/7170/files#diff-18f1bd8241119d62eddf36e6bf69d0f29bd8968bf2aca21d9d6238040c60189b
View file https://github.com/getsentry/sentry-python/blob/54334a33205b1f197b18ef487b1fc612ef6a16ad/tests/integrations/django/test_basic.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/7170/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/7170/files#diff-18f1bd8241119d62eddf36e6bf69d0f29bd8968bf2aca21d9d6238040c60189b
https://github.com/getsentry/sentry-python/pull/7170/files#diff-18f1bd8241119d62eddf36e6bf69d0f29bd8968bf2aca21d9d6238040c60189b
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
tests/integrations/django/test_cache_module.pyhttps://github.com/getsentry/sentry-python/pull/7170/files#diff-c1f33e78b1097a7bf798677671ca8e96a19673afcac6faa0c7637e2f953f6fee
View file https://github.com/getsentry/sentry-python/blob/54334a33205b1f197b18ef487b1fc612ef6a16ad/tests/integrations/django/test_cache_module.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/7170/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/7170/files#diff-c1f33e78b1097a7bf798677671ca8e96a19673afcac6faa0c7637e2f953f6fee
https://github.com/getsentry/sentry-python/pull/7170/files#diff-c1f33e78b1097a7bf798677671ca8e96a19673afcac6faa0c7637e2f953f6fee
https://github.com/getsentry/sentry-python/pull/7170/files#diff-c1f33e78b1097a7bf798677671ca8e96a19673afcac6faa0c7637e2f953f6fee
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
tests/integrations/flask/test_flask.pyhttps://github.com/getsentry/sentry-python/pull/7170/files#diff-01db75b6a9e974a9450a181c711ba26dbff2f28520e7c4ff2044fbf0efa8af7d
View file https://github.com/getsentry/sentry-python/blob/54334a33205b1f197b18ef487b1fc612ef6a16ad/tests/integrations/flask/test_flask.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/7170/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/7170/files#diff-01db75b6a9e974a9450a181c711ba26dbff2f28520e7c4ff2044fbf0efa8af7d
https://github.com/getsentry/sentry-python/pull/7170/files#diff-01db75b6a9e974a9450a181c711ba26dbff2f28520e7c4ff2044fbf0efa8af7d
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/7170/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.