feat(node): Support Prisma 8 in prismaIntegration - #24682
Conversation
|
bugbot run |
| end(error); | ||
| return Promise.reject(error); | ||
| } | ||
| return settle(runUnderSpan(span, () => iterator.throw!(error))); |
There was a problem hiding this comment.
Uncommented non-null assertions
Low Severity
iterator.return! and iterator.throw! are non-null assertions with no comment on why a narrower type is not possible. Flagged because the review rules require that explanation on new ! assertions in SDK source.
Additional Locations (1)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 4e7097b. Configure here.
size-limit report 📦
|
4e7097b to
685f3c5
Compare
|
bugbot run |
| expect(operationSpans).toEqual([]); | ||
| querySpans.forEach(span => expect(span.parent_span_id).toBe(segment?.span_id)); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Test branches on instrumentation mode
Low Severity
The new Prisma v8 test branches on expectsOperationSpans and returns early for the CJS-on-older-Node path. That hides two different user-visible outcomes in one case: operation spans nested over pg queries versus pg-only spans parented to the transaction. This was flagged because the review rules call out conditionals in a single test.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 685f3c5. Configure here.
685f3c5 to
3e27580
Compare
|
bugbot run |
3e27580 to
268cb2f
Compare
|
bugbot run |
| (createRunner, test) => { | ||
| test('should instrument PostgreSQL queries from Prisma ORM via pg', { timeout: 75_000 }, async () => { | ||
| (createRunner, test, mode) => { | ||
| if (mode === 'cjs' && !cjsLoadsInstrumentedEsm) { |
There was a problem hiding this comment.
q: Can't we use a conditionalTest({ min: 22 }) for this instead?
There was a problem hiding this comment.
Done: conditionalTest({ min: 22 }) and conditionalTest({ max: 21 }) now pick the two CJS variants; the manual version parsing is gone.
268cb2f to
ed14806
Compare
|
bugbot run |
|
bugbot run |
Prisma 8 has no tracing surface, so wrap its ORM terminals via orchestrion instead. Each ORM call gets a `prisma:client:operation` span (`db.operation.name`, `db.collection.name`, plus v7's `method`, `model` and `name`) with the `pg` query spans nested underneath. No user code is needed. The patch point is `CollectionImpl` in the transitive `@prisma/orm-family-sql` package, pinned to `>=8.0.0-rc.8 <9`. Lazy terminals (`all`, `createAll`, `updateAll`, `deleteAll`) return a single-use thenable that orchestrion's promise wrapper would consume, so they are wrapped `Sync` and the subscriber hooks `toArray` and the async iterator instead. Terminals calling terminals reuse the outer span. Operation spans require a parent span. CommonJS apps load the ESM-only runtime through `require(esm)`, which only the synchronous module hooks (Node 24.13 / 25.1) transform; older Node keeps `pg`-only spans in CJS. ESM apps are fully covered. Fixes #24237 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ed14806 to
8f706a5
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8f706a5. Configure here.
Prisma 8 is instrumented through diagnostics channels starting with SDK 11.1.0. Add it to the supported versions and note its span shape and limitations. Refs getsentry/sentry-javascript#24682 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
## pnpm-workspace.yaml (default) ## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `@sentry/cloudflare` | 11.0.0 | 11.1.0 | minor | | `@sentry/react` | 11.0.0 | 11.1.0 | minor | ## Release Notes <details> <summary><b>@<!---->sentry/cloudflare</b> (11.0.0 → 11.1.0)</summary> ### Important Changes - **feat(server-utils): Auto-instrument MCP servers via orchestrion ([#24529](getsentry/sentry-javascript#24529 A new default `mcpServerIntegration` wraps every `McpServer` instance (from `@modelcontextprotocol/server` and `@modelcontextprotocol/sdk`) when it is created. You no longer need to call `wrapMcpServerWithSentry` manually. You can still call `wrapMcpServerWithSentry` to override options, for example `recordInputs: false`. - **feat(node): Support Prisma 8 in `prismaIntegration` ([#24682](getsentry/sentry-javascript#24682 `prismaIntegration` now creates a `prisma:client:operation` span for each Prisma 8 ORM call, with the database query spans nested below it. No code changes are necessary. - **feat(server-utils): Add TypeSafe integration ([#24703](getsentry/sentry-javascript#24703 A new default `typesafeIntegration` creates a `gen_ai.evaluate` span for each TypeSafe Jev call through `@typesafe-ai/sdk` (`TypeSafeClient.systemOne`). For runtimes without auto-instrumentation, use `instrumentTypeSafeClient()`. - **feat(server-utils): Instrument Vercel AI `experimental_evaluate` ([#24694](getsentry/sentry-javascript#24694 Vercel AI `experimental_evaluate` calls now create a `gen_ai.evaluate` span, with the state and questions as input messages and the answers as output messages. ### Other Changes - feat(browser): Add `onError` callback to `showReportDialog` ([#24780](getsentry/sentry-javascript#24780)) - feat(bun): Add client address, port and protocol to Bun.serve spans ([#24523](getsentry/sentry-javascript#24523)) - feat(cloudflare): Re-export httpServerIntegration from /request ([#24614](getsentry/sentry-javascript#24614)) - feat(remix): Add Remix 3 export subpaths and optional peer deps ([#24697](https://github.com/getsentry/sentry-javascr …[full notes](https://github.com/getsentry/sentry-javascript/releases/tag/11.1.0) </details> <details> <summary><b>@<!---->sentry/react</b> (11.0.0 → 11.1.0)</summary> ### Important Changes - **feat(server-utils): Auto-instrument MCP servers via orchestrion ([#24529](getsentry/sentry-javascript#24529 A new default `mcpServerIntegration` wraps every `McpServer` instance (from `@modelcontextprotocol/server` and `@modelcontextprotocol/sdk`) when it is created. You no longer need to call `wrapMcpServerWithSentry` manually. You can still call `wrapMcpServerWithSentry` to override options, for example `recordInputs: false`. - **feat(node): Support Prisma 8 in `prismaIntegration` ([#24682](getsentry/sentry-javascript#24682 `prismaIntegration` now creates a `prisma:client:operation` span for each Prisma 8 ORM call, with the database query spans nested below it. No code changes are necessary. - **feat(server-utils): Add TypeSafe integration ([#24703](getsentry/sentry-javascript#24703 A new default `typesafeIntegration` creates a `gen_ai.evaluate` span for each TypeSafe Jev call through `@typesafe-ai/sdk` (`TypeSafeClient.systemOne`). For runtimes without auto-instrumentation, use `instrumentTypeSafeClient()`. - **feat(server-utils): Instrument Vercel AI `experimental_evaluate` ([#24694](getsentry/sentry-javascript#24694 Vercel AI `experimental_evaluate` calls now create a `gen_ai.evaluate` span, with the state and questions as input messages and the answers as output messages. ### Other Changes - feat(browser): Add `onError` callback to `showReportDialog` ([#24780](getsentry/sentry-javascript#24780)) - feat(bun): Add client address, port and protocol to Bun.serve spans ([#24523](getsentry/sentry-javascript#24523)) - feat(cloudflare): Re-export httpServerIntegration from /request ([#24614](getsentry/sentry-javascript#24614)) - feat(remix): Add Remix 3 export subpaths and optional peer deps ([#24697](https://github.com/getsentry/sentry-javascr …[full notes](https://github.com/getsentry/sentry-javascript/releases/tag/11.1.0) </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>


Wraps Prisma 8's ORM terminals via orchestrion: each ORM call gets a
prisma:client:operationspan (sentry.op: db,db.operation.name,db.collection.name, plus v7'smethod/model/name) with thepgquery spans nested underneath. No user code needed.CollectionImplin the transitive@prisma/orm-family-sql, pinned>=8.0.0-rc.8 <9; verified on rc.8.all,createAll,updateAll,deleteAll) return a single-use thenable that orchestrion's promise wrapper would consume, so they're wrappedSyncand the subscriber hooks consumption instead.pg-only spans, sincerequire(esm)bypasses the module hooks there. From Node 22 on they're covered; with the async hooks (before Node 24.13 / 25.1) a call in the same tick as therequireruns before the SDK subscribes. ESM apps are fully covered.Fixes #24237