René's URL Explorer Experiment


Title: fix(integrations): record output for with_raw_response and with_streaming_response by chrikrah · Pull Request #8039 · getsentry/sentry-python · GitHub

Open Graph Title: fix(integrations): record output for with_raw_response and with_streaming_response by chrikrah · Pull Request #8039 · getsentry/sentry-python

X Title: fix(integrations): record output for with_raw_response and with_streaming_response by chrikrah · Pull Request #8039 · getsentry/sentry-python

Description: fix(integrations): record output for with_raw_response and with_streaming_response Description sentry_sdk/integrations/anthropic.py:794 requires hasattr(result, "content"). A .with_raw_response wrapper has no content, so the span ends at unknown_response on line 824. openai.py:919 passes the wrapper on too, and _set_completions_api_output_data finds no choices and records nothing. Both integration docs promise Sentry "will automatically collect information about prompts, tools, tokens, and models". The Anthropic page names messages.create as the supported function. .with_raw_response and .with_streaming_response call that same create behind an X-Stainless-Raw-Response header, so the span opens and records no output. Before: $ python -W ignore repro.py # master 2ffd383, anthropic 1.13.0, openai 3.29.0 anthropic/with_raw_response {'gen_ai.response.id': False, 'gen_ai.response.finish_reasons': False, 'gen_ai.usage.input_tokens': False, 'gen_ai.usage.output_tokens': False, 'gen_ai.response.text': False} unknown_response anthropic/with_streaming_response {'gen_ai.response.id': False, 'gen_ai.response.finish_reasons': False, 'gen_ai.usage.input_tokens': False, 'gen_ai.usage.output_tokens': False, 'gen_ai.response.text': False} unknown_response openai/with_raw_response {'gen_ai.usage.input_tokens': False, 'gen_ai.usage.output_tokens': False, 'gen_ai.response.text': False} openai/with_streaming_response {'gen_ai.usage.input_tokens': False, 'gen_ai.usage.output_tokens': False, 'gen_ai.response.text': False} After: $ python -W ignore repro.py # this branch anthropic/with_raw_response {'gen_ai.response.id': True, 'gen_ai.response.finish_reasons': True, 'gen_ai.usage.input_tokens': True, 'gen_ai.usage.output_tokens': True, 'gen_ai.response.text': True} anthropic/with_streaming_response {'gen_ai.response.id': True, 'gen_ai.response.finish_reasons': True, 'gen_ai.usage.input_tokens': True, 'gen_ai.usage.output_tokens': True, 'gen_ai.response.text': True} openai/with_raw_response {'gen_ai.usage.input_tokens': True, 'gen_ai.usage.output_tokens': True, 'gen_ai.response.text': True} openai/with_streaming_response {'gen_ai.usage.input_tokens': True, 'gen_ai.usage.output_tokens': True, 'gen_ai.response.text': True} parse() caches its result, so parsing an already-read body where create would costs the caller nothing. A streamed body stays unread. The span fills when the caller parses it, and closes when the caller closes the response. A wrapper the caller neither parses nor closes leaves that span unfinished. The SDK then drops the span where baseline ends it. close() finishes the span wherever the wrapper offers one, and none of the 6 new tests covers that case. Verification $ python -m pytest -o addopts="" tests/integrations/anthropic/ tests/integrations/openai/ -q 1290 passed, 1716 warnings in 25.90s $ python -m pytest -o addopts="" tests/ -q -p no:randomly --ignore=tests/integrations/wsgi --ignore=tests/test_client.py 194 failed, 3083 passed, 171 skipped, 1938 warnings, 390 errors in 198.87s # baseline 2ffd383, same command: 194 failed, 3077 passed, 171 skipped, 1928 warnings, 390 errors in 179.49s # not run: the tests/integrations/wsgi and tests/test_client.py collections (werkzeug missing, one integration unavailable here) $ python -m ruff format sentry_sdk/integrations/anthropic.py sentry_sdk/integrations/openai.py tests/integrations/anthropic/test_raw_response.py tests/integrations/openai/test_raw_response.py && python -m ruff check sentry_sdk/integrations/anthropic.py sentry_sdk/integrations/openai.py tests/integrations/anthropic/test_raw_response.py tests/integrations/openai/test_raw_response.py 4 files left unchanged All checks passed! Baseline on 2ffd383 is 1284 passed, 1706 warnings in 26.98s, so the delta is the 6 new tests. Reverting both integration files and keeping the tests gives 6 failed, 10 warnings in 0.44s. Your #5917, after #5890, stopped wrapping responses without _iterator. It said tracing LegacyAPIResponse was intentionally out of scope. This change keeps that guard and picks up only the deferral. It fills the span for the wrapper without touching _iterator or reading an unread body. Fixes #7948 @alexander-alderman-webb Your #7948 reply put this on PY-2950. #7891 is the separate parse() gap on a plain create, which I have not touched here. If the openai work has started, I would close this instead. Otherwise it is ready to land ahead of PY-2950. Does that timing suit you?

Open Graph Description: fix(integrations): record output for with_raw_response and with_streaming_response Description sentry_sdk/integrations/anthropic.py:794 requires hasattr(result, "content"). A .with_raw_re...

X Description: fix(integrations): record output for with_raw_response and with_streaming_response Description sentry_sdk/integrations/anthropic.py:794 requires hasattr(result, "content"). A .wit...

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

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:f990344a-24c5-033c-4fa0-4fc13894f0d5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB0BE:33D24F:5B71F3:77455B:6B00DEB3
html-safe-nonce6a4223504cd86ed2c701c8c1913a6a97698b4aad88cbf343d6adcf972e246e0c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEJFOjMzRDI0Rjo1QjcxRjM6Nzc0NTVCOjZCMDBERUIzIiwidmlzaXRvcl9pZCI6IjE1NTc1MDQ0MTQ5MTMxOTE2MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac84735386c19769b21039795da222ae1dfe200973e9956e284ce2c1a27d8113f6
hovercard-subject-tagpull_request:4864406723
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/8039/files
twitter:imagehttps://avatars.githubusercontent.com/u/48338417?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/48338417?s=400&v=4
og:image:altfix(integrations): record output for with_raw_response and with_streaming_response Description sentry_sdk/integrations/anthropic.py:794 requires hasattr(result, "content"). A .with_raw_re...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf
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
release5425dc24e8bd8d6fca9641a12afc984825a43875
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/8039/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F8039%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%2F8039%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/8039/files
Reloadhttps://github.com/getsentry/sentry-python/pull/8039/files
Reloadhttps://github.com/getsentry/sentry-python/pull/8039/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
chrikrahhttps://github.com/chrikrah
getsentry:masterhttps://github.com/getsentry/sentry-python/tree/master
chrikrah:fix/integrations-raw-response-outputhttps://github.com/chrikrah/sentry-python/tree/fix/integrations-raw-response-output
Conversation 1 https://github.com/getsentry/sentry-python/pull/8039
Commits 1 https://github.com/getsentry/sentry-python/pull/8039/commits
Checks 3 https://github.com/getsentry/sentry-python/pull/8039/checks
Files changed https://github.com/getsentry/sentry-python/pull/8039/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8039/files
fix(integrations): record output for with_raw_response and with_streaming_response https://github.com/getsentry/sentry-python/pull/8039/files#top
Show all changes 1 commit https://github.com/getsentry/sentry-python/pull/8039/files
74ceaec fix(integrations): record output for with_raw_response and with_strea… chrikrah Oct 14, 2026 https://github.com/getsentry/sentry-python/pull/8039/commits/74ceaec1ad4e267865fc98f5da548c870dcb26a8
Clear filters https://github.com/getsentry/sentry-python/pull/8039/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8039/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8039/files
anthropic.py https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
openai.py https://github.com/getsentry/sentry-python/pull/8039/files#diff-8be672624748ac6598fe3d702a6beaf03e1fa6bc3c5f8aeadf68158d401fe34e
test_raw_response.py https://github.com/getsentry/sentry-python/pull/8039/files#diff-598c493f55574b12a508666837e73b34d669481da566756bd892e2d904245fa8
test_raw_response.py https://github.com/getsentry/sentry-python/pull/8039/files#diff-ecca973e08324ae5b86f1bca10297f0552747117960af0108a400b4a081bba89
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/integrations/anthropic.pyhttps://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
View file https://github.com/chrikrah/sentry-python/blob/74ceaec1ad4e267865fc98f5da548c870dcb26a8/sentry_sdk/integrations/anthropic.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/8039/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
https://github.com/getsentry/sentry-python/pull/8039/files#diff-2fe73f39bab33821a7af1fccb0fd22b943b931b2cbf8d13aead2784b3cd21e05
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8039/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.