Skip to content

feat(core): Add enableTruncation option to OpenAI integration#20167

Open
andreiborza wants to merge 3 commits intodevelopfrom
ab/openai-enable-truncation-option
Open

feat(core): Add enableTruncation option to OpenAI integration#20167
andreiborza wants to merge 3 commits intodevelopfrom
ab/openai-enable-truncation-option

Conversation

@andreiborza
Copy link
Copy Markdown
Member

@andreiborza andreiborza commented Apr 9, 2026

This PR adds an enableTruncation option to the OpenAI integration that allows users to disable input message truncation. It defaults to true to preserve existing behavior.

Closes: #20135

This PR adds an `enableTruncation` option to the OpenAI integration that allows
users to disable inpute message truncation. It defaults to `true` to preserve
existing behavior.

Closes: #20135
@andreiborza andreiborza requested a review from nicohrubec April 9, 2026 12:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

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


New Features ✨

Core

  • Add enableTruncation option to OpenAI integration by andreiborza in #20167
  • Support registerTool/registerResource/registerPrompt in MCP integration by betegon in #20071
  • Support embeddings in langchain by nicohrubec in #20017

Deps

  • Bump @hapi/content from 6.0.0 to 6.0.1 by dependabot in #20102
  • Bump bundler plugins to 5.2.0 by chargome in #20122
  • Bump lodash.template from 4.5.0 to 4.18.1 by dependabot in #20085
  • Bump @xmldom/xmldom from 0.8.3 to 0.8.12 by dependabot in #20066

Other

  • (aws-serverless) Add lambda extension to npm package by andreiborza in #20133
  • (cloudflare) Support basic WorkerEntrypoint by JPeer264 in #19884
  • (core, node) Portable Express integration by isaacs in #19928
  • (deno) Add denoRuntimeMetricsIntegration by chargome in #20023
  • (node, bun) Enforce minimum collection interval in runtime metrics integrations by chargome in #20068
  • (react-router) Export sentryOnError by chargome in #20120
  • Span Streaming by Lms24 in #19119

Bug Fixes 🐛

Core

  • Only attach flags context to error events by Lms24 in #20116
  • Replace regex with string check in stack parser to prevent main thread blocking by chargome in #20089
  • Set span.status to error when MCP tool returns JSON-RPC error response by betegon in #20082

Other

  • (angular) Bump TypeScript to ~6.0.0 in angular-21 E2E test app by andreiborza in #20134
  • (aws-serverless) Add timeout to _endSpan forceFlush to prevent Lambda hanging by logaretm in #20064
  • (cloudflare) Ensure every request instruments functions by JPeer264 in #20044
  • (gatsby) Fix errorHandler signature to match bundler-plugin-core API by JPeer264 in #20048

Internal Changes 🔧

Core

  • Do not emit spans for chats.create in google-genai by nicohrubec in #19990
  • Unify .do* span ops to gen_ai.generate_content by nicohrubec in #20074
  • Simplify addResponseAttributes in openai integration by nicohrubec in #20013
  • Extract shared endStreamSpan for AI integrations by nicohrubec in #20021
  • Remove provider-specific AI span attributes in favor of gen_ai attributes in sentry conventions by nicohrubec in #20011

Deps

  • Bump mshick/add-pr-comment from dd126dd8c253650d181ad9538d8b4fa218fc31e8 to e7516d74559b5514092f5b096ed29a629a1237c6 by dependabot in #20078
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.24.1 to 2.25.2 by dependabot in #20081

Other

  • (deps-dev) Bump effect from 3.20.0 to 3.21.0 by dependabot in #19999
  • (node) Add node integration tests for Vercel ToolLoopAgent by nicohrubec in #20087
  • (nuxt) Make Nuxt 5 (nightly) E2E optional by s1gr1d in #20113
  • (oxlint) Add typeawareness into oxlintrc by JPeer264 in #20075
  • Update validate-pr workflow by stephanie-anderson in #20072
  • Remove unused tsconfig-template folder by mydea in #20067

🤖 This preview updates automatically when you update the PR.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 03ad550. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.72 kB +0.31% +77 B 🔺
@sentry/browser - with treeshaking flags 24.21 kB +0.34% +82 B 🔺
@sentry/browser (incl. Tracing) 42.7 kB +1.29% +543 B 🔺
@sentry/browser (incl. Tracing, Profiling) 47.32 kB +1.19% +553 B 🔺
@sentry/browser (incl. Tracing, Replay) 81.51 kB +0.71% +573 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.08 kB +0.74% +520 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 86.22 kB +0.67% +568 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 98.42 kB +0.53% +511 B 🔺
@sentry/browser (incl. Feedback) 42.51 kB +0.21% +87 B 🔺
@sentry/browser (incl. sendFeedback) 30.39 kB +0.27% +80 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.38 kB +0.24% +83 B 🔺
@sentry/browser (incl. Metrics) 27.04 kB +0.31% +83 B 🔺
@sentry/browser (incl. Logs) 27.18 kB +0.3% +81 B 🔺
@sentry/browser (incl. Metrics & Logs) 27.86 kB +0.29% +80 B 🔺
@sentry/react 27.48 kB +0.26% +71 B 🔺
@sentry/react (incl. Tracing) 45.02 kB +1.21% +536 B 🔺
@sentry/vue 30.56 kB +1.61% +483 B 🔺
@sentry/vue (incl. Tracing) 44.56 kB +1.16% +507 B 🔺
@sentry/svelte 25.74 kB +0.3% +76 B 🔺
CDN Bundle 28.41 kB +0.3% +83 B 🔺
CDN Bundle (incl. Tracing) 43.72 kB +1.39% +596 B 🔺
CDN Bundle (incl. Logs, Metrics) 29.78 kB +0.31% +92 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 44.8 kB +1.44% +632 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 68.59 kB +0.16% +103 B 🔺
CDN Bundle (incl. Tracing, Replay) 80.6 kB +0.74% +588 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.63 kB +0.71% +571 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 86.14 kB +0.69% +587 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 87.17 kB +0.68% +584 B 🔺
CDN Bundle - uncompressed 82.99 kB +0.34% +279 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 129.64 kB +1.4% +1.78 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.14 kB +0.33% +279 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 133.05 kB +1.36% +1.78 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 210.12 kB +0.14% +279 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 246.52 kB +0.73% +1.78 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 249.91 kB +0.72% +1.78 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 259.43 kB +0.7% +1.78 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 262.82 kB +0.69% +1.78 kB 🔺
@sentry/nextjs (client) 47.44 kB +1.18% +550 B 🔺
@sentry/sveltekit (client) 43.16 kB +1.28% +545 B 🔺
@sentry/node-core 57.86 kB +3.78% +2.1 kB 🔺
@sentry/node 174.83 kB +1.41% +2.43 kB 🔺
@sentry/node - without tracing 97.97 kB +2.02% +1.94 kB 🔺
@sentry/aws-serverless 115.22 kB +2.11% +2.38 kB 🔺

View base workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,959 - 8,548 +5%
GET With Sentry 1,675 19% 1,662 +1%
GET With Sentry (error only) 5,874 66% 5,914 -1%
POST Baseline 1,161 - 1,191 -3%
POST With Sentry 547 47% 578 -5%
POST With Sentry (error only) 1,025 88% 1,032 -1%
MYSQL Baseline 3,123 - 3,146 -1%
MYSQL With Sentry 416 13% 406 +2%
MYSQL With Sentry (error only) 2,552 82% 2,556 -0%

View base workflow run

Copy link
Copy Markdown
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

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

nice!

}),
],
beforeSendTransaction: event => {
if (event.transaction.includes('/openai/')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: why drop here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This drops the express http transaction afaik, so that we can use the testing framework's .expect({ transaction } and match the ai transaction instead.

The other scenarios also do this.

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.

Add enableTruncation option to OpenAI integration

2 participants