Skip to content

docs(js): clarify OpenAI instrumentation for Cloudflare and tools - #18932

Merged
vgrozdanic merged 7 commits into
masterfrom
tet-2706/openai-cloudflare-docs-gaps
Aug 6, 2026
Merged

docs(js): clarify OpenAI instrumentation for Cloudflare and tools#18932
vgrozdanic merged 7 commits into
masterfrom
tet-2706/openai-cloudflare-docs-gaps

Conversation

@vgrozdanic

@vgrozdanic vgrozdanic commented Aug 4, 2026

Copy link
Copy Markdown
Member

From the TET-2706 OpenAI-on-Cloudflare audit:

  • Cloudflare Workers only get AI spans when the OpenAI client is manually wrapped (instrumentOpenAiClient); tracing alone is not enough.
  • The OpenAI client never runs app tools, so Sentry correctly does not emit gen_ai.execute_tool from this integration — only gen_ai.chat (including for responses.create) plus tool attributes on that span.
  • Stream token usage requires stream_options.include_usage on OpenAI; OpenAI-compatible providers may differ.

Add a Cloudflare Workers example for instrumentOpenAiClient, document
that tool execution spans are not created by the OpenAI client wrap,
and note streaming usage behavior for OpenAI-compatible providers.

Refs TET-2706
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview Aug 6, 2026 11:44am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview Aug 6, 2026 11:44am

Request Review

@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

TET-2706

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b245a1a58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/platforms/javascript/common/configuration/integrations/openai.mdx Outdated
Comment thread docs/platforms/javascript/common/configuration/integrations/openai.mdx Outdated
Explain that responses.create uses gen_ai.chat spans, add Durable Object
trace propagation and Conversations links for Cloudflare.
Remove permissive dataCollection from the Cloudflare example and gate
agent-tracing / Vercel AI links so browser guides point at
agent-tracing-browser instead of missing server pages.
@vgrozdanic
vgrozdanic marked this pull request as ready for review August 4, 2026 15:01
@vgrozdanic
vgrozdanic requested a review from a team August 4, 2026 15:01

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 179b2bb71e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/platforms/javascript/common/configuration/integrations/openai.mdx Outdated
Comment thread docs/platforms/javascript/common/configuration/integrations/openai.mdx Outdated
Require enableRpcTracePropagation on both Worker and DO, and gate
tool-execution guidance to platforms that actually host the linked pages.

Refs TET-2706
Co-Authored-By: opencode <noreply@opencode.ai>
Comment thread docs/platforms/javascript/common/configuration/integrations/openai.mdx Outdated
OpenAI page should not steer readers to a different integration; point
at manual agent instrumentation only.

Refs TET-2706
Co-Authored-By: opencode <noreply@opencode.ai>
Call the wrapper path "Instrument the Client" instead of "Manual
Instrumentation" — it is the primary setup on non-Node runtimes, not
hand-written spans.

Refs TET-2706
Co-Authored-By: opencode <noreply@opencode.ai>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d73395f394

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


Both APIs produce the same span type in Sentry: op `gen_ai.chat`, name like `chat <model>`. There is no separate `gen_ai.responses` span — `responses.create()` is still a model chat request under the hood, so it uses the standard chat operation.

### What is captured

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.

I don't think we need this headline here, we could leave it out since this is just continued from the previous part

@shellmayr shellmayr left a comment

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.

Looks good and understandable to me 👍

Keep the captured data paragraph as a continuation of the supported operations section.

Co-Authored-By: OpenCode <noreply@openai.com>
@vgrozdanic
vgrozdanic merged commit b7bf127 into master Aug 6, 2026
22 checks passed
@vgrozdanic
vgrozdanic deleted the tet-2706/openai-cloudflare-docs-gaps branch August 6, 2026 12:34
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.

2 participants