feat(ai): Re-export AI SDK manual instrumentation helpers#6028
Conversation
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
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
|
|
|
||
| - 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)) |
There was a problem hiding this comment.
Let's reference the PR here for consistency and to make the CI check happy
| - 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)) |
| GoogleGenAIClient, | ||
| GoogleGenAIChat, | ||
| GoogleGenAIOptions, | ||
| GoogleGenAIIstrumentedMethod, |
There was a problem hiding this comment.
I think there is a typo () but should be fixed on JS first
| GoogleGenAIIstrumentedMethod, | |
| GoogleGenAIInstrumentedMethod, |
antonis
left a comment
There was a problem hiding this comment.
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.
|
The upstream typo fix is in: getsentry/sentry-javascript#20416 (merged to Once |
## DESCRIBE YOUR PR Documents the OpenAI, Anthropic, Google Gen AI, LangChain, and LangGraph integrations for React Native. The automatic (OpenTelemetry-based) integrations for these SDKs ship only in `@sentry/node` and rely on Node.js require-hooks that aren't available on Hermes/JavaScriptCore. But the **manual client wrappers** (`instrumentOpenAiClient`, `instrumentAnthropicAiClient`, `instrumentGoogleGenAIClient`, `createLangChainCallbackHandler`, `instrumentLangGraph`) work in any JS runtime — including React Native. Depends on getsentry/sentry-react-native#6028. Closes getsentry/sentry-react-native#5297. ## IS YOUR CHANGE URGENT? - [x] None: Not urgent, can wait up to 1 week+ ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: Claude <noreply@anthropic.com>
Description
Re-exports the AI SDK manual instrumentation helpers from
@sentry/coreso 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/browseralready does and unblocks documentation for the RN AI SDK.Refs #5297.