René's URL Explorer Experiment


Title: feat(boto3): Instrument Bedrock Runtime streaming calls as gen_ai spans by sentry-junior[bot] · Pull Request #8189 · getsentry/sentry-python · GitHub

Open Graph Title: feat(boto3): Instrument Bedrock Runtime streaming calls as gen_ai spans by sentry-junior[bot] · Pull Request #8189 · getsentry/sentry-python

X Title: feat(boto3): Instrument Bedrock Runtime streaming calls as gen_ai spans by sentry-junior[bot] · Pull Request #8189 · getsentry/sentry-python

Description: Description This PR (3 of 3, stacked on #8187) records ConverseStream (chat) and InvokeModelWithResponseStream (generate_content) as gen_ai spans with gen_ai.response.streaming: true. The finish reason, token usage, and output messages (text, reasoning, and tool calls with streamed JSON arguments) are built from the events the caller receives. The span finishes once, when the stream is: exhausted close()d, read or unread stopped early, e.g. break (the iterator's GeneratorExit) failed, e.g. a modelStreamErrorException event or a read error. The error is re-raised unchanged and the span is marked as errored. Decisions the diff doesn't show: botocore.eventstream.EventStream.__iter__ and close are patched globally in setup_once. Python looks up __iter__ on the class, so it can't be patched per instance. The patch only acts on streams that carry a _sentry_hooks attribute, which this sets on instrumented Bedrock responses. Other event streams, e.g. S3 Select, go through yield from unchanged. This is the same approach as the Anthropic integration's Stream._iterator patch. The response object and the events the caller gets are untouched. InvokeModelWithResponseStream chunks are parsed per model family, like JS. Nova chunks reuse the ConverseStream parser, since they share its format. Usage falls back to Bedrock's amazon-bedrock-invocationMetrics in the last chunk. Claude output tokens come from message_delta rather than message_start, which JS uses and which reports only the first token. Output content is buffered only when data_collection.gen_ai.outputs (or, without data_collection, send_default_pii with include_prompts) allows recording it. That check, made when the stream starts, is the only gate on streamed outputs. Input messages are gated by data_collection.gen_ai.inputs when the request is made, as for the non-streaming calls. Malformed InvokeModelWithResponseStream chunks are skipped quietly. The caller still gets them unchanged. Changelog note ConverseStream and InvokeModelWithResponseStream spans change from http.client / auto.http.boto3 to gen_ai.chat and gen_ai.generate_content / auto.ai.boto3, and their names change from aws.bedrock-runtime.ConverseStream and aws.bedrock-runtime.InvokeModelWithResponseStream to chat and generate_content , which affects ignore_spans rules that match on the name. Boto3Integration is auto-enabled, so users with send_default_pii=True start sending streamed prompts and responses unless they set Boto3Integration(include_prompts=False) or configure data_collection. Issues Refs #5470. bedrock-agent-runtime (InvokeAgent) remains a follow-up. via @dcramer. -- View Session [Sentry]

Open Graph Description: Description This PR (3 of 3, stacked on #8187) records ConverseStream (chat) and InvokeModelWithResponseStream (generate_content) as gen_ai spans with gen_ai.response.streaming: true. The finish re...

X Description: Description This PR (3 of 3, stacked on #8187) records ConverseStream (chat) and InvokeModelWithResponseStream (generate_content) as gen_ai spans with gen_ai.response.streaming: true. The finish re...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4

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:d42a3c8b-711c-f5d4-7f96-a6f42e4d94dc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD76C:14CE41:6FC321:9C8CCA:6B044C4A
html-safe-noncedaac6dadde3e79683fbc487734ce4f971cfa83203ca1284179c37ea616e13e23
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzZDOjE0Q0U0MTo2RkMzMjE6OUM4Q0NBOjZCMDQ0QzRBIiwidmlzaXRvcl9pZCI6IjkxOTU5NTkxMjIxMjA2OTA3NjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1ae931c60558b99d09c25ecbe58484b4f1c6ac1ca2489b5dd1caa5cb1f7cf4da
hovercard-subject-tagpull_request:5162913783
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/8189/files
twitter:imagehttps://avatars.githubusercontent.com/in/2960336?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/2960336?s=400&v=4
og:image:altDescription This PR (3 of 3, stacked on #8187) records ConverseStream (chat) and InvokeModelWithResponseStream (generate_content) as gen_ai spans with gen_ai.response.streaming: true. The finish re...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730
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
release059f24c781e3a0d7df3f27a97da0e93fab06ae39
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/8189/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F8189%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%2F8189%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/8189/files
Reloadhttps://github.com/getsentry/sentry-python/pull/8189/files
Reloadhttps://github.com/getsentry/sentry-python/pull/8189/files
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues340 (340)https://github.com/getsentry/sentry-python/issues
Pull requests35 (35)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
sentry-juniorhttps://github.com/apps/sentry-junior
junior/boto3-bedrock-invoke-modelhttps://github.com/getsentry/sentry-python/tree/junior/boto3-bedrock-invoke-model
junior/boto3-bedrock-streaminghttps://github.com/getsentry/sentry-python/tree/junior/boto3-bedrock-streaming
Conversation 2 https://github.com/getsentry/sentry-python/pull/8189
Commits 2 https://github.com/getsentry/sentry-python/pull/8189/commits
Checks 330 https://github.com/getsentry/sentry-python/pull/8189/checks
Files changed https://github.com/getsentry/sentry-python/pull/8189/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8189/files
feat(boto3): Instrument Bedrock Runtime streaming calls as gen_ai spans https://github.com/getsentry/sentry-python/pull/8189/files#top
Show all changes 2 commits https://github.com/getsentry/sentry-python/pull/8189/files
0dae13b feat(boto3): Instrument Bedrock Runtime streaming calls as gen_ai spans sentry-junior[bot] Nov 4, 2026 https://github.com/getsentry/sentry-python/pull/8189/commits/0dae13b60009185bf7f9bddce3780dea071298ba
81e76ad fix(boto3): Skip malformed Bedrock stream chunks and gate stream outp… sentry-junior[bot] Nov 4, 2026 https://github.com/getsentry/sentry-python/pull/8189/commits/81e76ade572a3de1846c898961ca613448b55907
Clear filters https://github.com/getsentry/sentry-python/pull/8189/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8189/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8189/files
__init__.py https://github.com/getsentry/sentry-python/pull/8189/files#diff-2cfe4b72f14a798f54563e1082d67c0e551b5be15e31ef2303cf07e04955db35
_instrumentation.py https://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
bedrock_runtime.py https://github.com/getsentry/sentry-python/pull/8189/files#diff-43f466f3e11d254754d2935df7d1b46275f200462642e57d082240890e6edacd
test_bedrock_runtime.py https://github.com/getsentry/sentry-python/pull/8189/files#diff-431dbe73ff4d6b4b842f1d4d758a7c82ed4b96702c9647addd00d0a4c1b72b4d
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/integrations/boto3/__init__.pyhttps://github.com/getsentry/sentry-python/pull/8189/files#diff-2cfe4b72f14a798f54563e1082d67c0e551b5be15e31ef2303cf07e04955db35
View file https://github.com/getsentry/sentry-python/blob/81e76ade572a3de1846c898961ca613448b55907/sentry_sdk/integrations/boto3/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/8189/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/8189/files#diff-2cfe4b72f14a798f54563e1082d67c0e551b5be15e31ef2303cf07e04955db35
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/integrations/boto3/_instrumentation.pyhttps://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
View file https://github.com/getsentry/sentry-python/blob/81e76ade572a3de1846c898961ca613448b55907/sentry_sdk/integrations/boto3/_instrumentation.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/8189/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
https://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
https://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
https://github.com/getsentry/sentry-python/pull/8189/files#diff-5d72e4fbd709067f1b6c291d002a90436d530ee2837778e59f2b76c630264ea3
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8189/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/8189/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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.