diff --git a/docs/platforms/javascript/common/configuration/integrations/vercelai.mdx b/docs/platforms/javascript/common/configuration/integrations/vercelai.mdx index d0ff5f4bf4a4d3..6b8b651d241217 100644 --- a/docs/platforms/javascript/common/configuration/integrations/vercelai.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/vercelai.mdx @@ -34,6 +34,16 @@ Requires SDK version `10.12.0` or higher for Deno. + + + + +On Cloudflare, AI SDK v7 support requires SDK version `10.64.0` or higher and the `@sentry/cloudflare/nodejs_compat` entrypoint. + + + + + Don't use the AI SDK's `registerTelemetry` API (AI SDK v7 and above) together with this integration. Sentry's `vercelAIIntegration` already instruments the AI SDK, so registering telemetry separately will result in duplicate spans. @@ -185,7 +195,9 @@ Pass `experimental_telemetry` with `isEnabled: true` to the `ToolLoopAgent` cons ```javascript const agent = new ToolLoopAgent({ model: openai("gpt-4o"), - tools: { /* ... */ }, + tools: { + /* ... */ + }, experimental_telemetry: { isEnabled: true }, }); @@ -213,7 +225,9 @@ For `ToolLoopAgent`, set `functionId` in the constructor: ```javascript const agent = new ToolLoopAgent({ model: openai("gpt-4o"), - tools: { /* ... */ }, + tools: { + /* ... */ + }, experimental_telemetry: { isEnabled: true, functionId: "weather-agent", diff --git a/docs/platforms/javascript/guides/cloudflare/configuration/integrations/prisma.mdx b/docs/platforms/javascript/guides/cloudflare/configuration/integrations/prisma.mdx new file mode 100644 index 00000000000000..febbd812a4af15 --- /dev/null +++ b/docs/platforms/javascript/guides/cloudflare/configuration/integrations/prisma.mdx @@ -0,0 +1,42 @@ +--- +title: Prisma +description: "Adds instrumentation for Prisma ORM queries on Cloudflare Workers running with Node.js compatibility." +--- + + + +On Cloudflare, the `prismaIntegration` is only available through the `@sentry/cloudflare/nodejs_compat` entrypoint, which requires SDK version `10.64.0` or higher. + + + +_Import name: `Sentry.prismaIntegration`_ + +Sentry supports tracing [Prisma ORM](https://www.prisma.io/) queries with the Prisma integration. The integration creates a span for each query and reports relevant details to Sentry. + +To enable it on Cloudflare, import Sentry from the `@sentry/cloudflare/nodejs_compat` entrypoint and add the `prismaIntegration` to your `Sentry.init` call: + +```javascript {3,5} +import * as Sentry from "@sentry/cloudflare/nodejs_compat"; + +Sentry.init({ + tracesSampleRate: 1.0, + integrations: [Sentry.prismaIntegration()], +}); +``` + +This integration supports Prisma versions 5, 6, and 7. In Prisma v5, you also need to add the `tracing` preview feature to the `generator` block of your Prisma schema: + +```txt {tabTitle: Prisma Schema} {filename: schema.prisma} {3} +generator client { + provider = "prisma-client-js" + previewFeatures = ["tracing"] +} +``` + +## Supported Versions + +- `prisma`: `5.x`, `6.x`, `7.x` + +## Learn More + +For details on the span structure that Prisma's OpenTelemetry tracing produces (e.g., `prisma:client:operation`, `prisma:engine:db_query`), see the [Prisma trace output documentation](https://www.prisma.io/docs/orm/prisma-client/observability-and-logging/opentelemetry-tracing#trace-output). diff --git a/docs/platforms/javascript/guides/cloudflare/features/nodejs-compat.mdx b/docs/platforms/javascript/guides/cloudflare/features/nodejs-compat.mdx new file mode 100644 index 00000000000000..15019bda431390 --- /dev/null +++ b/docs/platforms/javascript/guides/cloudflare/features/nodejs-compat.mdx @@ -0,0 +1,44 @@ +--- +title: Node.js Compatibility Entrypoint +description: "Learn how the nodejs_compat entrypoint unlocks additional Node.js SDK features on Cloudflare Workers, such as Prisma instrumentation." +--- + +Cloudflare Workers can run with Node.js APIs enabled through the [`nodejs_compat` compatibility flag](https://developers.cloudflare.com/workers/runtime-apis/nodejs/). To take advantage of this, the Cloudflare SDK ships a dedicated `@sentry/cloudflare/nodejs_compat` entrypoint that unlocks Node.js SDK features which aren't available in the default Workers runtime. + + + +The `@sentry/cloudflare/nodejs_compat` entrypoint requires SDK version `10.64.0` or higher. It will become the default entrypoint in the next major version (v11). + + + +## What It Unlocks + +The `/nodejs_compat` entrypoint enables Node.js-only integrations and features on Cloudflare, including: + +- The `prismaIntegration` for tracing Prisma ORM queries. +- Vercel AI SDK v7 support for the `vercelAIIntegration`. + +## Usage + +The entrypoint is a drop-in replacement for `@sentry/cloudflare`, so switching over only requires changing your imports: + +```javascript {tabTitle:After} +import * as Sentry from "@sentry/cloudflare/nodejs_compat"; +``` + +```javascript {tabTitle:Before} +import * as Sentry from "@sentry/cloudflare"; +``` + +To use the entrypoint, your Worker must set the `nodejs_compat` compatibility flag in your Wrangler configuration: + + +```jsonc {tabTitle:JSON} {filename:wrangler.jsonc} +{ + "compatibility_flags": ["nodejs_compat"], +} +``` + +```toml {tabTitle:Toml} {filename:wrangler.toml} +compatibility_flags = ["nodejs_compat"] +``` diff --git a/docs/platforms/javascript/guides/cloudflare/index.mdx b/docs/platforms/javascript/guides/cloudflare/index.mdx index acd474a6197db8..28d35e561bc567 100644 --- a/docs/platforms/javascript/guides/cloudflare/index.mdx +++ b/docs/platforms/javascript/guides/cloudflare/index.mdx @@ -58,6 +58,12 @@ Run the command for your preferred package manager to add the Sentry SDK to your + + +Importing Sentry from the `@sentry/cloudflare/nodejs_compat` entrypoint unlocks additional Node.js SDK features on Cloudflare. It requires SDK version `10.64.0` or higher and will become the default in the next major version. [Learn more](./features/nodejs-compat). + + + ## Configure The main Sentry configuration should happen as early as possible in your app's lifecycle. diff --git a/platform-includes/configuration/integrations/javascript.cloudflare.mdx b/platform-includes/configuration/integrations/javascript.cloudflare.mdx index f27fd4ac838140..deddfb8faa9f77 100644 --- a/platform-includes/configuration/integrations/javascript.cloudflare.mdx +++ b/platform-includes/configuration/integrations/javascript.cloudflare.mdx @@ -1,7 +1,7 @@ ### Integrations | | **Auto Enabled** | **Errors** | **Tracing** | **Cron** | **Additional Context** | -|-----------------------------------------------------|:----------------:|:----------:|:-----------:|:--------:|:----------------------:| +| --------------------------------------------------- | :--------------: | :--------: | :---------: | :------: | :--------------------: | | [`dedupeIntegration`](./dedupe) | ✓ | ✓ | | | | | [`fetchIntegration`](./fetchIntegration) | ✓ | ✓ | ✓ | | | | [`functionToStringIntegration`](./functiontostring) | ✓ | | | | | @@ -13,4 +13,7 @@ | [`rewriteFramesIntegration`](./rewriteframes) | | ✓ | | | | | [`supabaseIntegration`](./supabase) | | ✓ | ✓ | | | | [`instrumentPostgresJsSql`](./postgresjs) | | | ✓ | | | +| [`prismaIntegration`](./prisma) | | | ✓ | | | | [`honoIntegration`](./hono) | ✓ | ✓ | | | | + +The [`prismaIntegration`](./prisma) is only available through the [`@sentry/cloudflare/nodejs_compat`](../../features/nodejs-compat) entrypoint.