René's URL Explorer Experiment


Title: feat(tracing): Handle `tracestate` HTTP headers/correlation context envelope headers by lobsterkatie · Pull Request #971 · getsentry/sentry-python · GitHub

Open Graph Title: feat(tracing): Handle `tracestate` HTTP headers/correlation context envelope headers by lobsterkatie · Pull Request #971 · getsentry/sentry-python

X Title: feat(tracing): Handle `tracestate` HTTP headers/correlation context envelope headers by lobsterkatie · Pull Request #971 · getsentry/sentry-python

Description: This PR is an initial implementation of the official tracestate spec (detailed here), which specifies a multi-vendor, vendor-neutral method of propagating trace data between services. The basic format of a tracestate header is vendor1=value1,vendor2=value2,vendor3=value3,.... Key Behaviors: When starting a transaction representing an incoming request*, the request's tracestate header is parsed, and Sentry and third-party portions are stored separately on the transaction If no Sentry portion is found, or if a transaction is not being started from headers, a new Sentry tracestate value is calculated and stored on the transaction Outgoing requests made while the transaction is open contain a tracestate header of the form sentry=sentry_value,vendor1=value1,vendor2=value2 (in other words, wherever the Sentry data was in the incoming list, it's moved to be the first entry) Transactions (and errors with attachments** sent while a transaction is open) include data from Sentry's tracestate value in their envelope headers * Now that there's more than one header, the from_traceparent method mentioned in an older version of our tracing spec (since replaced by from_sentrytrace in the spec, but not the SDK) is deprecated in favor of two new helper functions called from continue_from_headers. ** Error events with attachments just because those are the only ones currently sent in envelopes. Sentry's tracestate Value: The value in the HTTP header is the result of taking data of the form { "trace_id": ... , "release": ... , "environment": ... , "public_key": ... }, base64-encoding it, and stripping off any trailing =. (release and environment reflect the values set in sentry_sdk.init(), and public_key comes from the part of the DSN between the https:// and the @xxx.ingest.sentry.io.) The value in the envelope header is that same data, but without any encoding. Known Limitations: Compared to the spec, this does not handle: Multiple incoming tracestate headers Incoming third-party values which are empty (not not-there, but rather empty like the second entry in x=y,,z=w) Whitespace in the incoming tracestate header value Limiting the length of either the Sentry tracestate value or the overall tracestate header It also does not consume, create, or propagate traceparent headers. (We continue to use our own similar sentry-trace header.) Follow-up Tasks Decide if we like the new continue_from_headers/helper function model, and update dev docs Decide which, if any, of the known limitations listed above are worth fixing Update JS SDK to consume incoming tracestate headers and handle third-party tracestate values Sort out whether and how to include end-user data

Open Graph Description: This PR is an initial implementation of the official tracestate spec (detailed here), which specifies a multi-vendor, vendor-neutral method of propagating trace data between services. The basic for...

X Description: This PR is an initial implementation of the official tracestate spec (detailed here), which specifies a multi-vendor, vendor-neutral method of propagating trace data between services. The basic for...

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

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:bd9ff547-1b19-21c8-7206-9ba7ccf533c2
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCBD8:2C3566:4D27C8:687D2F:6B00CC0B
html-safe-nonce29c62b2c33c48406d980636dbde3b81b32d452f78edde9a229d1e0d4c35873c4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkQ4OjJDMzU2Njo0RDI3Qzg6Njg3RDJGOjZCMDBDQzBCIiwidmlzaXRvcl9pZCI6IjUwMDUxNTMxMjM4NzQ5NTAxNTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc7784426ce119d685e5262d392ebf4f4ff5f8be5096f891a7ea180ccc7215006
hovercard-subject-tagpull_request:553962563
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/971/files
twitter:imagehttps://avatars.githubusercontent.com/u/14812505?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14812505?s=400&v=4
og:image:altThis PR is an initial implementation of the official tracestate spec (detailed here), which specifies a multi-vendor, vendor-neutral method of propagating trace data between services. The basic for...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4
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
releaseef013399cf0a3c324bea644a685d7c1e0f06b5b7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/971/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F971%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%2F971%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/971/files
Reloadhttps://github.com/getsentry/sentry-python/pull/971/files
Reloadhttps://github.com/getsentry/sentry-python/pull/971/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
lobsterkatiehttps://github.com/lobsterkatie
kmclb-trace-context-pochttps://github.com/getsentry/sentry-python/tree/kmclb-trace-context-poc
kmclb-trace-context-in-envelope-headerhttps://github.com/getsentry/sentry-python/tree/kmclb-trace-context-in-envelope-header
Conversation 15 https://github.com/getsentry/sentry-python/pull/971
Commits 24 https://github.com/getsentry/sentry-python/pull/971/commits
Checks 0 https://github.com/getsentry/sentry-python/pull/971/checks
Files changed https://github.com/getsentry/sentry-python/pull/971/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/971/files
feat(tracing): Handle tracestate HTTP headers/correlation context envelope headers https://github.com/getsentry/sentry-python/pull/971/files#top
Show all changes 24 commits https://github.com/getsentry/sentry-python/pull/971/files
1782974 add base64 conversion methods lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/17829740712d0576286a06ee3661c38a2e4a310a
b187c2f add method to compute a transaction's tracestate value lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/b187c2fc70ac8657c58fc00e4b34ff2fbcb82e91
bba2880 add methods for extracting data from sentry-trace and tracestate headers lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/bba28805987bb17564de15c08660d519f3c635e5
94099d2 add sentry and third-party tracestate attributes to Transaction class lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/94099d2cbe43dcac468ff9219c7e1bedd76a0e2b
f6de104 pass sentry tracestate in event.contexts.trace for extraction when en… lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/f6de1043765196f2e5a2efcaa02ac339f3e4ee8c
5727ffc update docstrings lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/5727ffcf5a54932d409df027728acf6a2afeaa9e
dfbcbb7 use header data extraction methods rather than from_traceparent lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/dfbcbb7ce22d5e98a7ffea0947c9a8c864998c3e
e2fbc7a add trace correlation context to envelope header lobsterkatie Jan 13, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/e2fbc7a487c58e1438bad7f13d7be7fe7e66530f
a479936 add to_tracestate and use it in iter_headers lobsterkatie Jan 15, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/a4799363fdb33cf1f6aeea24172697b87568c0bc
60014d2 deprecate from_traceparent lobsterkatie Jan 15, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/60014d2dd753b257de65b96587fba3a42c0d674a
c6e19e4 make base64 conversion methods handle errors, add tests lobsterkatie Jan 19, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/c6e19e4bf680e3d5c8e3509e5ddae78a3f335509
2e0c7c2 fix tracestate extraction, add tests lobsterkatie Jan 20, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/2e0c7c2249a63b5da282a6a18212ffacf3d1871c
bc276ae fix bugs in to_tracestate, add tests lobsterkatie Jan 20, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/bc276ae1a57abce3dbadb68f276afd286f0ede2a
197217f handle errors when attaching trace data to envelope headers lobsterkatie Jan 20, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/197217f1afe1fb07ed46ddbc8e91ea08830a9cb3
fc19e88 move all tracing tests to tests/tracing lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/fc19e88f887e77ba199b6b29224091e6072b8dc1
a5900c1 split up tracestate computation, make it work for spans, too lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/a5900c152d1ad70e190eb55dc43dca339c5116ca
850c903 add method for reinflating tracestate lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/850c9031792a5fcbac8f0a04704bff0d7627a6be
4eb0cfb do base64 validation manually because py2 lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/4eb0cfb84987ceb866e98e00c893e55f1d99c1c6
46ff29b fixup splitting tracestate calculation lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/46ff29b8817278c194089ce21fc35ca407941988
6edac13 compute new tracestate value for orphan spans lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/6edac1340d9c16972fceca1945c9f5857adb7423
a4f8395 use reinflation method in client lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/a4f83957516ec60aef4645aaac16e471c58948aa
25edca9 add lots of tests lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/25edca9d4115472941f4243cbf1f8833d9fd90ca
d3a6303 general cleanup lobsterkatie Jan 25, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/d3a6303554bc094e7ffbf8a7d866bba3643c7415
97a4aaf store full sentry entry (rather than value) for tracestate lobsterkatie Feb 26, 2021 https://github.com/getsentry/sentry-python/pull/971/commits/97a4aafc67d3475c68da001d577ecb785720dbd0
Clear filters https://github.com/getsentry/sentry-python/pull/971/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/971/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/971/files
client.py https://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
hub.py https://github.com/getsentry/sentry-python/pull/971/files#diff-77d9f1abdc0bcb69029368ee19ece6f08f6d92ff07f80f53ffb1457dc75f7fd9
tracing.py https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
tracing_utils.py https://github.com/getsentry/sentry-python/pull/971/files#diff-7c64294459f5053c93d44e0e33e4e73ffcef0adefcd77ba91f4031aa461a8c42
utils.py https://github.com/getsentry/sentry-python/pull/971/files#diff-e9f88ca6368ce622839e078ed26c741a927752c01ceae64cd504d3ae86de6fd2
test_envelope.py https://github.com/getsentry/sentry-python/pull/971/files#diff-394a6d59305bc6fb84d5550956cc16af407d584a8669df7facef1c54203b995f
test_http_headers.py https://github.com/getsentry/sentry-python/pull/971/files#diff-9b0a1162ea3f06644064c9ab4784c80cd3d2d1d5e0ea81aaafccff047cc02e7f
test_integration_tests.py https://github.com/getsentry/sentry-python/pull/971/files#diff-9e67e9a51e2fc147ed6bf7bf9fcae17ef95fe960bd1eba5068f8109743357af6
test_misc.py https://github.com/getsentry/sentry-python/pull/971/files#diff-3e743413fb15a66395482f0e3a4c79a94010c629c8acc6428a1958dcefc2c78c
test_sampling.py https://github.com/getsentry/sentry-python/pull/971/files#diff-b51eab357bbfb00b250fe03b91239ec6bb40d7f11d4c0f22944f1b23d3d24fcc
test_general.py https://github.com/getsentry/sentry-python/pull/971/files#diff-a9b641cc8f69df0cae0be6d2bb7178e9629fe674557444a0f0dd61484a52a52e
sentry_sdk/client.pyhttps://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
View file https://github.com/getsentry/sentry-python/blob/97a4aafc67d3475c68da001d577ecb785720dbd0/sentry_sdk/client.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/971/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
https://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
https://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
https://github.com/getsentry/sentry-python/pull/971/files#diff-de17468b7fdc1d17ecfa0a4e5a26f61af3373576759e547c5c149e87b33c7bdd
sentry_sdk/hub.pyhttps://github.com/getsentry/sentry-python/pull/971/files#diff-77d9f1abdc0bcb69029368ee19ece6f08f6d92ff07f80f53ffb1457dc75f7fd9
View file https://github.com/getsentry/sentry-python/blob/97a4aafc67d3475c68da001d577ecb785720dbd0/sentry_sdk/hub.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/971/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/971/files#diff-77d9f1abdc0bcb69029368ee19ece6f08f6d92ff07f80f53ffb1457dc75f7fd9
https://github.com/getsentry/sentry-python/pull/971/files#diff-77d9f1abdc0bcb69029368ee19ece6f08f6d92ff07f80f53ffb1457dc75f7fd9
https://github.com/getsentry/sentry-python/pull/971/files#diff-77d9f1abdc0bcb69029368ee19ece6f08f6d92ff07f80f53ffb1457dc75f7fd9
sentry_sdk/tracing.pyhttps://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
View file https://github.com/getsentry/sentry-python/blob/97a4aafc67d3475c68da001d577ecb785720dbd0/sentry_sdk/tracing.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/971/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
https://github.com/getsentry/sentry-python/pull/971/files#diff-771cb012ea65fcb826b77e2abb36b504fdf3407fbe8054857b05fe5a41ed5164
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/971/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.