Skip to content

fix(Prisma): update span description for Prisma v7+#19924

Open
julien1619 wants to merge 1 commit intogetsentry:developfrom
julien1619:patch-1
Open

fix(Prisma): update span description for Prisma v7+#19924
julien1619 wants to merge 1 commit intogetsentry:developfrom
julien1619:patch-1

Conversation

@julien1619
Copy link

This pull request makes a small but important update to the Prisma tracing integration. The change ensures that both engine-level and client-level database queries are properly named in tracing spans, improving visibility and debugging for Prisma queries.

  • Updated the span naming logic in prismaIntegration to also cover prisma:client:db_query events (v7+), in addition to prisma:engine:db_query, ensuring that the query text is used as the span name for both types of database queries. (packages/node/src/integrations/tracing/prisma.ts)

Relates to #18797

@github-actions
Copy link
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Deps

  • Bump mongodb-memory-server-global from 10.1.4 to 11.0.1 by dependabot in #19888
  • Bump stacktrace-parser from 0.1.10 to 0.1.11 by dependabot in #19887

Bug Fixes 🐛

Core

  • Do not overwrite user provided conversation id in Vercel by nicohrubec in #19903
  • Return same value from startSpan as callback returns by s1gr1d in #19300

Deps

  • Bump next to 15.5.14 in nextjs-15 and nextjs-15-intl E2E test apps by chargome in #19917
  • Bump socket.io-parser to 4.2.6 to fix CVE-2026-33151 by chargome in #19880

Other

  • (cloudflare) Forward ctx argument to Workflow.do user callback by Lms24 in #19891
  • (craft) Add missing mainDocsUrl for @sentry/effect SDK by bc-sentry in #19860
  • (nestjs) Add node to nest metadata by chargome in #19875
  • (Prisma) Update span description for Prisma v7+ by julien1619 in #19924
  • (serverless) Add node to metadata by nicohrubec in #19878

Internal Changes 🔧

  • (astro) Re-enable server island tracing e2e test in Astro 6 by Lms24 in #19872
  • (ci) Fix "Gatbsy" typo in issue package label workflow by chargome in #19905
  • (lint) Resolve oxlint warnings by isaacs in #19893
  • (node-integration-tests) Remove unnecessary file-type dependency by Lms24 in #19824
  • (sveltekit) Replace recast + @babel/parser with acorn by roli-lpci in #19533
  • Add external contributor to CHANGELOG.md by javascript-sdk-gitflow in #19909

🤖 This preview updates automatically when you update the PR.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


// Make sure we use the query text as the span name, for ex. SELECT * FROM "User" WHERE "id" = $1
if (spanJSON.description === 'prisma:engine:db_query' && spanJSON.data['db.query.text']) {
if ((spanJSON.description === 'prisma:engine:db_query' || spanJSON.description === 'prisma:client:db_query') && spanJSON.data['db.query.text']) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix PR lacks test verifying the regression fix

Medium Severity

This fix PR does not include a test that verifies the regression is actually fixed. The existing v7 integration test at prisma-orm-v7/test.ts expects description === 'prisma:client:db_query' (the unfixed behavior), meaning it either doesn't cover this fix at all, or the fix is ineffective because db.query.text isn't available at spanStart time for v7. Compare with the v6 test, which properly asserts the description is updated to the actual SQL query text. A test confirming the span description gets updated for prisma:client:db_query spans is needed.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

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.

1 participant