From 96c867873a6420269b08571f7b69e15dc69861b3 Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Thu, 16 Jul 2026 17:04:31 +0200 Subject: [PATCH 1/2] feat(server-utils): Share one orchestrion channel across OpenAI chat/responses/conversations Chat completions, the responses API, and the conversations API all report a `chat` operation with identical span handling, so they can publish to a single `chat` channel. Reduces the tracing-channel count with no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/integrations/tracing-channel/openai.ts | 5 ++--- .../server-utils/src/orchestrion/config/openai.ts | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/server-utils/src/integrations/tracing-channel/openai.ts b/packages/server-utils/src/integrations/tracing-channel/openai.ts index e1498db89e43..8da8519936de 100644 --- a/packages/server-utils/src/integrations/tracing-channel/openai.ts +++ b/packages/server-utils/src/integrations/tracing-channel/openai.ts @@ -26,12 +26,11 @@ const INTEGRATION_NAME = 'OpenAI' as const; // are attributable separately from the OTel/proxy one. const ORIGIN = 'auto.ai.orchestrion.openai'; -// Each instrumented `create` method maps to the gen_ai operation its span reports. +// Each instrumented `create` method maps to the gen_ai operation its span reports. Chat completions, +// the responses API, and the conversations API all share the `chat` channel and operation. const INSTRUMENTED_CHANNELS = [ { channel: CHANNELS.OPENAI_CHAT, operation: 'chat' }, - { channel: CHANNELS.OPENAI_RESPONSES, operation: 'chat' }, { channel: CHANNELS.OPENAI_EMBEDDINGS, operation: 'embeddings' }, - { channel: CHANNELS.OPENAI_CONVERSATIONS, operation: 'chat' }, ] as const; /** diff --git a/packages/server-utils/src/orchestrion/config/openai.ts b/packages/server-utils/src/orchestrion/config/openai.ts index e8091003fc58..6fbe08da92f7 100644 --- a/packages/server-utils/src/orchestrion/config/openai.ts +++ b/packages/server-utils/src/orchestrion/config/openai.ts @@ -9,9 +9,10 @@ export const openaiConfig = [ module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Completions', methodName: 'create', kind: 'Auto' as const }, })), - // OpenAI responses API — same `create(body, options)` shape as chat completions. + // OpenAI responses API — same `create(body, options)` shape as chat completions, and the subscriber + // reports it as the same `chat` operation, so it shares the `chat` channel. ...['resources/responses/responses.js', 'resources/responses/responses.mjs'].map(filePath => ({ - channelName: 'responses', + channelName: 'chat', module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Responses', methodName: 'create', kind: 'Auto' as const }, })), @@ -21,17 +22,18 @@ export const openaiConfig = [ module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Embeddings', methodName: 'create', kind: 'Auto' as const }, })), - // OpenAI conversations API — same `create(body, options)` shape as chat completions. + // OpenAI conversations API — same `create(body, options)` shape as chat completions, reported as the + // same `chat` operation, so it shares the `chat` channel. ...['resources/conversations/conversations.js', 'resources/conversations/conversations.mjs'].map(filePath => ({ - channelName: 'conversations', + channelName: 'chat', module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Conversations', methodName: 'create', kind: 'Auto' as const }, })), ] satisfies InstrumentationConfig[]; export const openaiChannels = { + // Chat completions, the responses API, and the conversations API all report a `chat` operation with + // identical span handling, so they share one channel. OPENAI_CHAT: 'orchestrion:openai:chat', - OPENAI_RESPONSES: 'orchestrion:openai:responses', OPENAI_EMBEDDINGS: 'orchestrion:openai:embeddings', - OPENAI_CONVERSATIONS: 'orchestrion:openai:conversations', } as const; From 10ab82864c5f8a987a3b14f97a0c0f91c1f27c3d Mon Sep 17 00:00:00 2001 From: Nicolas Hrubec Date: Thu, 16 Jul 2026 17:11:23 +0200 Subject: [PATCH 2/2] docs(server-utils): Trim redundant OpenAI chat-channel comments Co-Authored-By: Claude Opus 4.8 (1M context) --- .../server-utils/src/integrations/tracing-channel/openai.ts | 3 +-- packages/server-utils/src/orchestrion/config/openai.ts | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/server-utils/src/integrations/tracing-channel/openai.ts b/packages/server-utils/src/integrations/tracing-channel/openai.ts index 8da8519936de..b172c6924300 100644 --- a/packages/server-utils/src/integrations/tracing-channel/openai.ts +++ b/packages/server-utils/src/integrations/tracing-channel/openai.ts @@ -26,8 +26,7 @@ const INTEGRATION_NAME = 'OpenAI' as const; // are attributable separately from the OTel/proxy one. const ORIGIN = 'auto.ai.orchestrion.openai'; -// Each instrumented `create` method maps to the gen_ai operation its span reports. Chat completions, -// the responses API, and the conversations API all share the `chat` channel and operation. +// Each instrumented `create` method maps to the gen_ai operation its span reports. const INSTRUMENTED_CHANNELS = [ { channel: CHANNELS.OPENAI_CHAT, operation: 'chat' }, { channel: CHANNELS.OPENAI_EMBEDDINGS, operation: 'embeddings' }, diff --git a/packages/server-utils/src/orchestrion/config/openai.ts b/packages/server-utils/src/orchestrion/config/openai.ts index 6fbe08da92f7..4d32e45cf2ca 100644 --- a/packages/server-utils/src/orchestrion/config/openai.ts +++ b/packages/server-utils/src/orchestrion/config/openai.ts @@ -9,8 +9,7 @@ export const openaiConfig = [ module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Completions', methodName: 'create', kind: 'Auto' as const }, })), - // OpenAI responses API — same `create(body, options)` shape as chat completions, and the subscriber - // reports it as the same `chat` operation, so it shares the `chat` channel. + // OpenAI responses API — same `create(body, options)` shape as chat completions. ...['resources/responses/responses.js', 'resources/responses/responses.mjs'].map(filePath => ({ channelName: 'chat', module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, @@ -22,8 +21,7 @@ export const openaiConfig = [ module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath }, functionQuery: { className: 'Embeddings', methodName: 'create', kind: 'Auto' as const }, })), - // OpenAI conversations API — same `create(body, options)` shape as chat completions, reported as the - // same `chat` operation, so it shares the `chat` channel. + // OpenAI conversations API — same `create(body, options)` shape as chat completions. ...['resources/conversations/conversations.js', 'resources/conversations/conversations.mjs'].map(filePath => ({ channelName: 'chat', module: { name: 'openai', versionRange: '>=4.0.0 <7', filePath },