Skip to content

fix(server-utils): Support openai v7 in auto-instrumentation - #23512

Merged
chargome merged 5 commits into
developfrom
fix/openai-v7-support
Aug 24, 2026
Merged

fix(server-utils): Support openai v7 in auto-instrumentation#23512
chargome merged 5 commits into
developfrom
fix/openai-v7-support

Conversation

@chargome

@chargome chargome commented Aug 24, 2026

Copy link
Copy Markdown
Member

The orchestrion config capped openai at <7, so the code transformer never matched v7 modules and auto-instrumentation silently failed on the current major (latest stable is 7.5.0).

This bumps the cap to <8 — v7's only breaking change was requiring Node.js 22, so every instrumented match point is unchanged. Adds an openai/v7 integration suite pinning 7.5.0, skipped below Node 22.

Fixes #23511

The orchestrion config capped `openai` at `<7`, so the code transformer never
matched v7 modules and auto-instrumentation silently produced no spans on the
current major.

Bump the cap to `<8`. v7's only breaking change was requiring Node.js 22, so
every instrumented match point is unchanged. Add a unit test covering 4.x-7.x
against the real transformer, and an `openai/v7` integration suite pinning
7.5.0, skipped below Node 22.

Fixes #23511
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome chargome self-assigned this Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.33 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.35 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.24 kB - -
@sentry/browser (incl. Tracing, Replay) 87.73 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.19 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.44 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.12 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.47 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.33 kB - -
@sentry/react (incl. Tracing) 50.51 kB - -
@sentry/vue 35.4 kB - -
@sentry/vue (incl. Tracing) 50.31 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.32 kB - -
CDN Bundle (incl. Tracing) 48.87 kB - -
CDN Bundle (incl. Logs, Metrics) 32.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.74 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.91 kB - -
CDN Bundle (incl. Tracing, Replay) 86.33 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94 kB - -
CDN Bundle - uncompressed 89.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.13 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 151.81 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 284.76 kB - -
@sentry/nextjs (client) 53.05 kB - -
@sentry/sveltekit (client) 48.74 kB - -
@sentry/core/server 64.95 kB - -
@sentry/core/browser 52.11 kB - -
@sentry/node 117.49 kB +0.03% +24 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB -0.01% -2 B 🔽
@sentry/node - without tracing 82.03 kB +0.03% +23 B 🔺
@sentry/aws-serverless 91.46 kB +0.03% +19 B 🔺
@sentry/cloudflare (withSentry) - minified 194.68 kB - -
@sentry/cloudflare (withSentry) 481.33 kB - -

View base workflow run

chargome and others added 2 commits August 24, 2026 14:25
The v7 suite inherited `traceLifecycle: 'static'` from the v6 suite, which
carries it from #22589. Span streaming is the default lifecycle, so exercise
that instead.

Under streaming there are no transaction envelopes and the mock server's own
spans stream in alongside the gen_ai ones, so the transaction expectation and
the fixed item count are dropped in favour of selecting the spans under test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous commit moved the whole suite to `traceLifecycle: 'stream'`, which
made the chat test fail on the Node 26 CI leg. The span buffer flushes on a 5s
timer per trace and the runner asserts against one envelope at a time, so once
the scenario ran past that window its later spans landed in a second envelope
the assertion never saw. Reproduced on Node 22 by delaying the scenario past 5s.

Put the exhaustive assertions back on the static lifecycle, where every span
arrives in one envelope, and cover streaming with a separate instrument file
that asserts only on the first call's span. This mirrors how the v4/v5 suite
splits `instrument.mjs` and `instrument-span-streaming.mjs`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome marked this pull request as ready for review August 24, 2026 15:16
@chargome
chargome requested review from a team as code owners August 24, 2026 15:16
@chargome
chargome requested review from JPeer264, RulaKhaled, andreiborza and isaacs and removed request for a team and isaacs August 24, 2026 15:16
@@ -0,0 +1,81 @@
import { createCodeTransformer } from '@apm-js-collab/code-transformer-bundler-plugins/core';

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.

do we need this? we have integration tests to check this works e2e and to detect new majors we should probably use canary tests or expand the framework updates skill

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.

yeah this was a leftover, we'll move them into canary tests

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.

+1 I think we should get rid of this

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.

@@ -0,0 +1,81 @@
import { createCodeTransformer } from '@apm-js-collab/code-transformer-bundler-plugins/core';

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.

+1 I think we should get rid of this

The declared range will be covered by canary tests against the latest published
version instead, which exercises the real package rather than a synthetic one.

Refs #23515

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome merged commit 8b5483c into develop Aug 24, 2026
200 of 201 checks passed
@chargome
chargome deleted the fix/openai-v7-support branch August 24, 2026 17:44
JPeer264 pushed a commit that referenced this pull request Aug 25, 2026
The orchestrion config capped `openai` at `<7`, so the code transformer
never matched v7 modules and auto-instrumentation silently failed on the
current major (latest stable is 7.5.0).

This bumps the cap to `<8` — v7's only breaking change was requiring
Node.js 22, so every instrumented match point is unchanged. Adds an
`openai/v7` integration suite pinning 7.5.0, skipped below Node 22.

Fixes #23511

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

openai v7 is not covered by auto-instrumentation

3 participants