fix(server-utils): Support openai v7 in auto-instrumentation - #23512
Merged
Conversation
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>
Contributor
size-limit report 📦
|
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
marked this pull request as ready for review
August 24, 2026 15:16
chargome
requested review from
JPeer264,
RulaKhaled,
andreiborza and
isaacs
and removed request for
a team and
isaacs
August 24, 2026 15:16
nicohrubec
reviewed
Aug 24, 2026
| @@ -0,0 +1,81 @@ | |||
| import { createCodeTransformer } from '@apm-js-collab/code-transformer-bundler-plugins/core'; | |||
Member
There was a problem hiding this comment.
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
Member
Author
There was a problem hiding this comment.
yeah this was a leftover, we'll move them into canary tests
Member
There was a problem hiding this comment.
+1 I think we should get rid of this
andreiborza
approved these changes
Aug 24, 2026
| @@ -0,0 +1,81 @@ | |||
| import { createCodeTransformer } from '@apm-js-collab/code-transformer-bundler-plugins/core'; | |||
Member
There was a problem hiding this comment.
+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>
nicohrubec
approved these changes
Aug 24, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The orchestrion config capped
openaiat<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 anopenai/v7integration suite pinning 7.5.0, skipped below Node 22.Fixes #23511