René's URL Explorer Experiment


Title: Rework `sampling_context` · Issue #3746 · getsentry/sentry-python · GitHub

Open Graph Title: Rework `sampling_context` · Issue #3746 · getsentry/sentry-python

X Title: Rework `sampling_context` · Issue #3746 · getsentry/sentry-python

Description: (custom_)sampling_context is a Sentry-specific concept that doesn't fit with how OTel works. The purpose of a sampling_context is to provide extra external data to use for decision making in the traces_sampler. Right now, we're using it ...

Open Graph Description: (custom_)sampling_context is a Sentry-specific concept that doesn't fit with how OTel works. The purpose of a sampling_context is to provide extra external data to use for decision making in the tr...

X Description: (custom_)sampling_context is a Sentry-specific concept that doesn't fit with how OTel works. The purpose of a sampling_context is to provide extra external data to use for decision making in th...

Opengraph URL: https://github.com/getsentry/sentry-python/issues/3746

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rework `sampling_context`","articleBody":"`(custom_)sampling_context` is a Sentry-specific concept that doesn't fit with how OTel works.\n\nThe purpose of a `sampling_context` is to provide extra external data to use for decision making in the `traces_sampler`. Right now, we're using it to make things like the transaction name, parent sampled decision, request object or queue name accessible in the sampler.\n\nThe goal is to store everything necessary on the span as attributes instead and expose those. However, since attribute types are very limited, we can't just save a custom object like e.g. the request as an attribute. Instead, we need to preprocess it into serializable attributes. For each integration, we need to see what important data we can extract and save on the span.\n\nThe idea:\n- no `custom_sampling_context` argument for `start_transaction`/`start_span` anymore\n- `start_span` instead gets an extra `attributes` argument which, when provided, prepopulates the attributes\n- integrations that were providing a `custom_sampling_context` will instead provide a set of prepopulated `attributes` (that can't be objects)\n- the `sampling_context` accessible in `traces_sampler` will change:\n  - it'll contain all span attributes by default\n  - it'll also contain the current data (`transaction_context.name`, `transaction_context.op`, `parent_sampled`) in some slightly modified form\n\nIntegrations that are currently setting a `custom_sampling_context` that will now have to set specific attributes:\n\n- [x] aiohttp https://github.com/getsentry/sentry-python/pull/3782\n- [x] asgi https://github.com/getsentry/sentry-python/pull/3764 & https://github.com/getsentry/sentry-python/pull/3774\n- [x] aws_lambda https://github.com/getsentry/sentry-python/pull/3814\n- [x] celery https://github.com/getsentry/sentry-python/pull/3813\n- [x] gcp https://github.com/getsentry/sentry-python/pull/3818\n- [x] rq https://github.com/getsentry/sentry-python/pull/3786\n- [x] tornado https://github.com/getsentry/sentry-python/pull/3784\n- [x] wsgi  https://github.com/getsentry/sentry-python/pull/3775\n- [x] extra\n  - see if there's any framework-specific stuff in e.g. the asgi scope (starlette/fastapi adds `endpoint`, for instance), and add if possible\n  - seen in the wild: `wsgi_environ.REQUEST_URI`, `wsgi_environ.HTTP_` headers stuff\n  - consider serializing args and kwargs (mostly celery, rq) always in the same way (i.e., not via `_serialize_span_attributes`) so that the type doesn't randomly change on users\n  - error handling (`except:` or `capture_internal_exceptions`)\n\n\nRelated:\n\n- [x] Allow to pass attributes to `POTelSpan` https://github.com/getsentry/sentry-python/pull/3747\n- [x] Document this properly in the migration guide for each integration\n- [ ] Change documentation https://docs.sentry.io/platforms/python/configuration/sampling/ https://github.com/getsentry/sentry-python/issues/3933","author":{"url":"https://github.com/sentrivana","@type":"Person","name":"sentrivana"},"datePublished":"2024-11-07T10:00:55Z","url":"https://github.com/getsentry/sentry-python/issues/3746"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:99e26ba7-3c57-b09e-802e-1eb19b47868a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8414:1AE20C:83075:AB76C:6B00C568
html-safe-nonce6cd82250a3367e8ce66ef10f6267f9164ff98c4a0f13d202e80c13baafe961e7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDE0OjFBRTIwQzo4MzA3NTpBQjc2Qzo2QjAwQzU2OCIsInZpc2l0b3JfaWQiOiI4NjY0Mjc3Njk0NTUwMTY0ODQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd633181022b5d7cd3177983a1d965283683372fcc9feb0d7d78a18c3fa1b4353
hovercard-subject-tagissue:2640495580
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/3746/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4042845b90197a47e228d90e264a76a90c3d5fd94ac3f8fd3ca324a9d12653ed/getsentry/sentry-python/issues/3746
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4042845b90197a47e228d90e264a76a90c3d5fd94ac3f8fd3ca324a9d12653ed/getsentry/sentry-python/issues/3746
og:image:alt(custom_)sampling_context is a Sentry-specific concept that doesn't fit with how OTel works. The purpose of a sampling_context is to provide extra external data to use for decision making in the tr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesentrivana
hostnamegithub.com
expected-hostnamegithub.com
None98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseef013399cf0a3c324bea644a685d7c1e0f06b5b7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/issues/3746#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fissues%2F3746
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%2Fissues%2F3746
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/issues/3746
Reloadhttps://github.com/getsentry/sentry-python/issues/3746
Reloadhttps://github.com/getsentry/sentry-python/issues/3746
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
https://github.com/getsentry/sentry-python
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/3746
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/3746
Rework sampling_contexthttps://github.com/getsentry/sentry-python/issues/3746#top
https://github.com/sentrivana
Project: POTelhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Project%3A%20POTel%22
PythonSDKhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Python%22
Taskhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Task%22
Performance powered by OTel (POTel)https://github.com/getsentry/sentry-python/milestone/20
https://github.com/sentrivana
sentrivanahttps://github.com/sentrivana
on Nov 7, 2024https://github.com/getsentry/sentry-python/issues/3746#issue-2640495580
Extract span attrs from AIOHTTP request #3782https://github.com/getsentry/sentry-python/pull/3782
Unpack custom_sampling_context into attributes in ASGI #3764https://github.com/getsentry/sentry-python/pull/3764
Use semantic attributes in traces sampler for ASGI spans #3774https://github.com/getsentry/sentry-python/pull/3774
Span attrs instead of AWS custom sampling context #3814https://github.com/getsentry/sentry-python/pull/3814
Turn custom_sampling_context into span attrs in Celery integration #3813https://github.com/getsentry/sentry-python/pull/3813
Use span attrs in GCP sampling context #3818https://github.com/getsentry/sentry-python/pull/3818
Extract span attrs from RQ job object & fix tests #3786https://github.com/getsentry/sentry-python/pull/3786
Extract span attrs from Tornado request #3784https://github.com/getsentry/sentry-python/pull/3784
Unpack WSGI environ into span attrs accessible in traces sampler #3775https://github.com/getsentry/sentry-python/pull/3775
Remove custom_sampling_context #3747https://github.com/getsentry/sentry-python/pull/3747
https://docs.sentry.io/platforms/python/configuration/sampling/https://docs.sentry.io/platforms/python/configuration/sampling/
Update custom_sampling_context docs #3933https://github.com/getsentry/sentry-python/issues/3933
sentrivanahttps://github.com/sentrivana
Project: POTelhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Project%3A%20POTel%22
on Nov 7, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15176422346
https://github.com/antonpirker
antonpirkerhttps://github.com/antonpirker
on Nov 7, 2024https://github.com/getsentry/sentry-python/issues/3746#issuecomment-2461868672
https://docs.sentry.io/platforms/python/configuration/sampling/https://docs.sentry.io/platforms/python/configuration/sampling/
sentrivanahttps://github.com/sentrivana
on Nov 7, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15177468296
sentrivanahttps://github.com/sentrivana
on Nov 7, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15177922825
sentrivanahttps://github.com/sentrivana
on Nov 12, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15265522119
Remove custom_sampling_context (#3747)https://github.com/getsentry/sentry-python/commit/afd8cc598b620db0203c7f728563e37d7bb7b50f
#3747https://github.com/getsentry/sentry-python/pull/3747
afd8cc5https://github.com/getsentry/sentry-python/commit/afd8cc598b620db0203c7f728563e37d7bb7b50f
sentrivanahttps://github.com/sentrivana
on Nov 18, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15335584198
sentrivanahttps://github.com/sentrivana
Performance powered by OTel (POTel)https://github.com/getsentry/sentry-python/milestone/20
on Dec 5, 2024https://github.com/getsentry/sentry-python/issues/3746#event-15542311230
sentrivanahttps://github.com/sentrivana
completedhttps://github.com/getsentry/sentry-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jan 14, 2025https://github.com/getsentry/sentry-python/issues/3746#event-15922714404
stephanie-andersonhttps://github.com/stephanie-anderson
on Apr 28, 2025https://github.com/getsentry/sentry-python/issues/3746#event-17439110925
Build 3.0 infrastructure #4339https://github.com/getsentry/sentry-python/issues/4339
stephanie-andersonhttps://github.com/stephanie-anderson
on Jun 3, 2025https://github.com/getsentry/sentry-python/issues/3746#event-17953904430
stephanie-andersonhttps://github.com/stephanie-anderson
completedhttps://github.com/getsentry/sentry-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 3, 2025https://github.com/getsentry/sentry-python/issues/3746#event-17954548475
linearhttps://github.com/apps/linear
Taskhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Task%22
on Jun 3, 2025https://github.com/getsentry/sentry-python/issues/3746#event-17958219281
dingsdaxhttps://github.com/dingsdax
PythonSDKhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Python%22
on Mar 24, 2026https://github.com/getsentry/sentry-python/issues/3746#event-23842419270
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-python/issues/3746
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-python/issues/3746
sentrivanahttps://github.com/sentrivana
Project: POTelhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Project%3A%20POTel%22
PythonSDKhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Python%22
Taskhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Task%22
Performance powered by OTel (POTel)https://github.com/getsentry/sentry-python/milestone/20
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.