Skip to content

feat(ai): Re-export AI SDK manual instrumentation helpers#6028

Merged
alwx merged 3 commits intomainfrom
feat/ai-sdk-exports
Apr 21, 2026
Merged

feat(ai): Re-export AI SDK manual instrumentation helpers#6028
alwx merged 3 commits intomainfrom
feat/ai-sdk-exports

Conversation

@alwx
Copy link
Copy Markdown
Contributor

@alwx alwx commented Apr 21, 2026

Description

Re-exports the AI SDK manual instrumentation helpers from @sentry/core so React Native apps can import them directly from @sentry/react-native.

Why

The automatic (OpenTelemetry-based) integrations for the OpenAI / Anthropic / Google GenAI / LangChain / LangGraph SDKs only work in Node.js runtimes. React Native apps have to use the manual client wrappers. Previously, reaching those helpers required importing from @sentry/core, which is awkward and undocumented for RN users. This change mirrors what @sentry/browser already does and unblocks documentation for the RN AI SDK.

Refs #5297.

Adds re-exports from @sentry/core for the AI SDK manual instrumentation
helpers so React Native apps can import them directly from
@sentry/react-native:

- instrumentOpenAiClient
- instrumentAnthropicAiClient
- instrumentGoogleGenAIClient
- createLangChainCallbackHandler
- instrumentLangGraph
- instrumentStateGraphCompile

Also re-exports the related types.

The automatic (OpenTelemetry-based) integrations for these SDKs only
work in Node.js runtimes, so React Native apps have to use the manual
client wrappers. Previously users had to reach into @sentry/core to
access them, which is awkward. This change aligns the React Native SDK
with @sentry/browser, which already re-exports the same helpers.

Refs #5297
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(ai): Re-export AI SDK manual instrumentation helpers by alwx in #6028
  • feat(core): Add GlobalErrorBoundary for non-rendering errors by alwx in #6023
  • chore(deps): update CLI to v3.4.0 by github-actions in #6026
  • feat: Expose screenshot masking options for error screenshots by antonis in #6007
  • fix(replay): Check captureReplay return value in iOS bridge by antonis in #6008
  • chore(deps): bump getsentry/craft from 2.25.2 to 2.25.4 by dependabot in #6019
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.25.2 to 2.25.4 by dependabot in #6021
  • chore(deps): bump github/codeql-action from 4.35.1 to 4.35.2 by dependabot in #6022
  • chore(deps): bump actions/setup-node from 6.3.0 to 6.4.0 by dependabot in #6020
  • ci(danger): Demote Android SDK version mismatch from fail to warn by antonis in #6018
  • chore(deps): update Android SDK to v8.39.1 by github-actions in #6010
  • chore(deps): update JavaScript SDK to v10.49.0 by github-actions in #6011
  • ci: Integrate Warden for AI-powered PR code review by antonis in #6003
  • chore(lint): Fixes lint issue on main by antonis in #6013
  • feat(expo): Warn when prebuilt native projects are missing Sentry config by alwx in #5984

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 36a85c2

@alwx alwx marked this pull request as ready for review April 21, 2026 09:33
Comment thread CHANGELOG.md Outdated

- Expose screenshot masking options (`screenshot.maskAllText`, `screenshot.maskAllImages`, `screenshot.maskedViewClasses`, `screenshot.unmaskedViewClasses`) for error screenshots ([#6007](https://github.com/getsentry/sentry-react-native/pull/6007))
- Warn Expo users at Metro startup when prebuilt native projects are missing Sentry configuration ([#5984](https://github.com/getsentry/sentry-react-native/pull/5984))
- Re-export AI SDK manual instrumentation helpers (`instrumentOpenAiClient`, `instrumentAnthropicAiClient`, `instrumentGoogleGenAIClient`, `createLangChainCallbackHandler`, `instrumentLangGraph`, `instrumentStateGraphCompile`) for use in React Native apps ([#5297](https://github.com/getsentry/sentry-react-native/issues/5297))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reference the PR here for consistency and to make the CI check happy

Suggested change
- Re-export AI SDK manual instrumentation helpers (`instrumentOpenAiClient`, `instrumentAnthropicAiClient`, `instrumentGoogleGenAIClient`, `createLangChainCallbackHandler`, `instrumentLangGraph`, `instrumentStateGraphCompile`) for use in React Native apps ([#5297](https://github.com/getsentry/sentry-react-native/issues/5297))
- Re-export AI SDK manual instrumentation helpers (`instrumentOpenAiClient`, `instrumentAnthropicAiClient`, `instrumentGoogleGenAIClient`, `createLangChainCallbackHandler`, `instrumentLangGraph`, `instrumentStateGraphCompile`) for use in React Native apps ([#6028](https://github.com/getsentry/sentry-react-native/pull/6028))

Comment thread packages/core/src/js/index.ts Outdated
GoogleGenAIClient,
GoogleGenAIChat,
GoogleGenAIOptions,
GoogleGenAIIstrumentedMethod,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a typo () but should be fixed on JS first

Suggested change
GoogleGenAIIstrumentedMethod,
GoogleGenAIInstrumentedMethod,

Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the changelog LGTM. I think we should raise with JS team to fix the typo or open a PR directly

- CHANGELOG entry now references the PR number (#6028) so the Danger
  check passes.
- Drop the re-export of `GoogleGenAIIstrumentedMethod` — it is a typo
  in the upstream `@sentry/core` export (missing 'n'). Will be added
  back once the typo is fixed in sentry-javascript.
Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alwx
Copy link
Copy Markdown
Contributor Author

alwx commented Apr 21, 2026

The upstream typo fix is in: getsentry/sentry-javascript#20416 (merged to develop). It renames the type to GoogleGenAIInstrumentedMethod and keeps the misspelled GoogleGenAIIstrumentedMethod as a deprecated alias.

Once @sentry/core cuts a release containing that change and RN picks it up via scripts/update-javascript.sh, we can add the correctly-spelled GoogleGenAIInstrumentedMethod to the re-exports in packages/core/src/js/index.ts as a tiny follow-up.

@alwx alwx merged commit 50212fd into main Apr 21, 2026
56 of 62 checks passed
@alwx alwx deleted the feat/ai-sdk-exports branch April 21, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants