Skip to content

feat(server-utils): Migrate OpenAI integration to orchestrion#21877

Open
nicohrubec wants to merge 7 commits into
developfrom
nh/openai-orchestrion
Open

feat(server-utils): Migrate OpenAI integration to orchestrion#21877
nicohrubec wants to merge 7 commits into
developfrom
nh/openai-orchestrion

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Jul 1, 2026

Copy link
Copy Markdown
Member

Adds an orchestrion based OpenAI integration to server-utils, covering all the APIs and both streaming and non-streaming mode. Leaves the core integration intact and only exports the necessary utils that are needed for the orchestrion integration.

Comment thread packages/server-utils/src/integrations/tracing-channel/openai.ts
Comment thread packages/server-utils/src/integrations/tracing-channel/openai.ts Outdated
@nicohrubec nicohrubec force-pushed the nh/openai-orchestrion branch from b53ebd6 to 8149b88 Compare July 1, 2026 09:29
@github-actions

github-actions Bot commented Jul 1, 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 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.05 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.79 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.81 kB - -
@sentry/browser (incl. Tracing, Replay) 85.28 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.89 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.97 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.64 kB - -
@sentry/browser (incl. Feedback) 44.77 kB - -
@sentry/browser (incl. sendFeedback) 32.39 kB - -
@sentry/browser (incl. FeedbackAsync) 37.52 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.6 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.35 kB - -
@sentry/vue 32.82 kB - -
@sentry/vue (incl. Tracing) 47.91 kB - -
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 47.98 kB - -
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.32 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.77 kB - -
CDN Bundle (incl. Tracing, Replay) 85.48 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.76 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.53 kB - -
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.28 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.25 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.59 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.25 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 277.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.94 kB - -
@sentry/nextjs (client) 50.73 kB - -
@sentry/sveltekit (client) 46.44 kB - -
@sentry/core/server 77.8 kB +0.07% +47 B 🔺
@sentry/core/browser 64.1 kB +0.07% +41 B 🔺
@sentry/node-core 62.37 kB -0.01% -1 B 🔽
@sentry/node 121.5 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.46 kB -0.01% -1 B 🔽
@sentry/node - without tracing 72.68 kB -0.01% -1 B 🔽
@sentry/aws-serverless 83.52 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 180.62 kB - -
@sentry/cloudflare (withSentry) 446.93 kB - -

View base workflow run

@nicohrubec nicohrubec force-pushed the nh/openai-orchestrion branch 2 times, most recently from e03ecce to 856774b Compare July 1, 2026 10:15
mysqlChannelIntegration(),
lruMemoizerChannelIntegration(),
openaiChannelIntegration(),
] as const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Integration options dropped on swap

Medium Severity

With diagnostics-channel injection enabled, default integrations drop the OTel OpenAI integration and append openaiChannelIntegration() with no options. Any recordInputs, recordOutputs, or enableTruncation passed to openAIIntegration(...) are ignored unless the same values are set via dataCollection.genAI or a manually configured channel integration.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 856774b. Configure 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.

I think this is fine. Users can still configure this using the global dataCollection object and the integration itself is already configurable so once this is the default this should work again

@nicohrubec nicohrubec force-pushed the nh/openai-orchestrion branch from 856774b to bf560d7 Compare July 1, 2026 10:18
Add a diagnostics-channel (orchestrion) instrumentation path for
`chat.completions.create` (non-streaming) alongside the existing proxy/OTel
path. Reuses the core attribute helpers and `bindTracingChannelToSpan`; the
browser/edge keep the proxy `instrumentOpenAiClient`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec force-pushed the nh/openai-orchestrion branch 3 times, most recently from c758392 to 127e3b2 Compare July 1, 2026 10:59
Adds a diagnostics-channel (orchestrion) path for non-streaming
`responses.create`, alongside the existing `chat.completions.create`. Reuses
the shared core attribute helpers (responses shape already handled) and
generalizes the subscriber to a per-channel operation table.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec changed the title feat(node): Port OpenAI chat completions to orchestrion feat(node): Add orchestrion-based OpenAI integration Jul 1, 2026
@nicohrubec nicohrubec changed the title feat(node): Add orchestrion-based OpenAI integration feat(server-utils): Migrate OpenAI integration to orchestrion Jul 1, 2026
nicohrubec and others added 2 commits July 1, 2026 13:56
Adds a diagnostics-channel path for `embeddings.create` (operation `embeddings`),
reusing the shared core attribute helpers and the per-channel operation table.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a diagnostics-channel path for `conversations.create`, reusing the shared
core attribute helpers (conversation-id capture) and the per-channel operation table.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec changed the title feat(server-utils): Migrate OpenAI integration to orchestrion feat(server-utils): Migrate OpenAI integration to orchestrion (non-streaming) Jul 1, 2026
Instruments streaming `chat.completions.create` / `responses.create` by patching
the returned `Stream`'s async iterator in place (via `bindTracingChannelToSpan`'s
`deferSpanEnd`) so the reused `instrumentStream` accumulates chunk state and ends
the span when iteration completes. Exports `instrumentStream` from core.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec changed the title feat(server-utils): Migrate OpenAI integration to orchestrion (non-streaming) feat(server-utils): Migrate OpenAI integration to orchestrion Jul 1, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 9ca6a54. Configure here.

Comment thread packages/server-utils/src/integrations/tracing-channel/openai.ts
@nicohrubec nicohrubec marked this pull request as ready for review July 1, 2026 16:42
@nicohrubec nicohrubec requested a review from a team as a code owner July 1, 2026 16:42
@nicohrubec nicohrubec requested review from JPeer264 and mydea and removed request for a team July 1, 2026 16:42
@nicohrubec nicohrubec requested a review from andreiborza July 1, 2026 16:42
Comment thread packages/server-utils/src/integrations/tracing-channel/openai.ts
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.

1 participant