Skip to content

feat: Add opt-in vercelAiIntegration to cloudflare & vercel-edge - #16732

Merged
mydea merged 13 commits into
developfrom
fn/vercel-ai-cloudflare
Jun 26, 2025
Merged

feat: Add opt-in vercelAiIntegration to cloudflare & vercel-edge#16732
mydea merged 13 commits into
developfrom
fn/vercel-ai-cloudflare

Conversation

@mydea

@mydeamydea commented Jun 25, 2025

Copy link
Copy Markdown
Member

This is on top of #16714.

This adds the vercelAiIntegration to the cloudflare SDK, as well as to the vercel-edge SDK.

I moved the critical code from node to core package, so we can reuse this (the code to process spans).

The integration is not added by default, but needs to be added manually. then it will "force" add the event processors etc. We cannot auto-detect the ai package, sadly, because this does not work in workers 😢 so for now it needs to be added manually to avoid overhead for users that don't need this.

@andreiborza let's verify that this works when deployed to cloudflare, esp. also the auto-enablement via the modules integration etc 🤔

@mydeamydea self-assigned this Jun 25, 2025
@mydea
mydeaforce-pushed the fn/vercel-ai-cloudflare branch from a6417a2 to b7df3e9CompareJune 25, 2025 11:05
Comment threadpackages/cloudflare/src/integrations/tracing/vercelai.ts Outdated
Comment threadpackages/cloudflare/src/integrations/tracing/vercelai.ts Outdated
Comment threadpackages/cloudflare/src/integrations/tracing/vercelai.ts Outdated
@mydea
mydeaforce-pushed the fn/vercel-ai-cloudflare branch 2 times, most recently from a7827af to 6b09503CompareJune 25, 2025 12:25
@github-actions

github-actionsBot commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser23.99 kB--
@sentry/browser - with treeshaking flags23.76 kB--
@sentry/browser (incl. Tracing)38.84 kB--
@sentry/browser (incl. Tracing, Replay)76.98 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags70.07 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)81.74 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)93.83 kB--
@sentry/browser (incl. Feedback)40.75 kB--
@sentry/browser (incl. sendFeedback)28.7 kB--
@sentry/browser (incl. FeedbackAsync)33.59 kB--
@sentry/react25.76 kB--
@sentry/react (incl. Tracing)40.84 kB--
@sentry/vue28.36 kB--
@sentry/vue (incl. Tracing)40.7 kB--
@sentry/svelte24.01 kB--
CDN Bundle25.5 kB--
CDN Bundle (incl. Tracing)38.92 kB--
CDN Bundle (incl. Tracing, Replay)74.83 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)80.29 kB--
CDN Bundle - uncompressed74.5 kB--
CDN Bundle (incl. Tracing) - uncompressed115.42 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed229.47 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed242.3 kB--
@sentry/nextjs (client)42.47 kB--
@sentry/sveltekit (client)39.33 kB--
@sentry/node150.91 kB+0.03%+40 B 🔺
@sentry/node - without tracing98.63 kB--
@sentry/aws-serverless124.4 kB+0.01%+1 B 🔺

View base workflow run

Comment threadpackages/core/src/utils/vercel-ai.ts
Comment threadpackages/node/src/integrations/tracing/vercelai/index.ts
@mydea
mydeaforce-pushed the fn/vercel-ai-cloudflare branch from 7865cc5 to 6c68d0eCompareJune 26, 2025 07:45
@mydeamydea changed the title feat(cloudflare): Add vercelAiIntegration & modulesIntegrationfeat(cloudflare): Add opt-in vercelAiIntegrationJun 26, 2025
@mydeamydea changed the title feat(cloudflare): Add opt-in vercelAiIntegrationfeat: Add opt-in vercelAiIntegration to cloudflare & vercel-edgeJun 26, 2025
* This is a copy of the Vercel AI integration from the node SDK.
*
* The only difference is that it does not use `@opentelemetry/instrumentation`
* because Cloudflare Workers do not support it.

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.

Suggested change
*becauseCloudflareWorkersdonotsupportit.
*becausevercel-edgedoesnotsupportit.

@mydea
mydeaforce-pushed the fn/vercel-ai-cloudflare branch from 45f2304 to d898309CompareJune 26, 2025 10:37
@mydea
mydea merged commit 40f04bc into developJun 26, 2025
@mydea
mydea deleted the fn/vercel-ai-cloudflare branch June 26, 2025 10:57
Sign up for freeto 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

@mydea@andreiborza