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 |
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.