GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(server-utils): Move to new `getSqlQueryAttributes` helper for consistency by mydea · Pull Request #25927 · getsentry/sentry-javascript

Conversation

@mydea

@mydea mydea commented Oct 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Why: sanitizeSqlQueryWithSummary grew a third value with db.operation.name, and every SQL integration copied the result into the same three attributes by hand. getSqlQueryAttributes returns them keyed by attribute name, so integrations spread it and the keys can't drift. The mysql2 diagnostics-channel subscriber and postgres.js drop their own operation regexes for the shared helper, so their db.operation.name keeps the statement's case and resolves CTEs like the other integrations (postgres.js still prefers the server-reported command once a query succeeds). postgres.js also no longer reports the sanitizer's Unknown SQL Query placeholder as db.query.text when there is no query; its public requestHook gets '' in that case.

How to review: Start with utils/sql.ts, then the Prisma tracing helper. Prisma keeps its own db.query.text/db.operation.name and only falls back to ours; db.query.summary is always ours, so the streamed span name stays dialect-aware across Prisma versions. Prisma 5 only reports db.statement, so its spans now also get a sanitized db.query.text (see the v5 test). Tedious clears the summary and operation name for procedure calls, as before.

Unsure about: @sentry/server-utils exports the renamed helper, but the package is internal (no SemVer guarantee) and Nuxt pins it exactly, so I didn't keep an alias.

Stacked on #25850.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mydea
mydea added this pull request to stack #25928 October 30, 2026 08:44
This was referenced Oct 30, 2026
feat(server-utils): Set db.operation.name on SQL spans #25850
Merged
feat(server-utils): Extract getSqlSpanName for SQL span names #25929
Merged
@github-actions

github-actions Bot commented Oct 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 173afee (PR test merge using develop at 90450a6)

Against: 2f5a2f9 (develop) · base run #64409

⚠️ Baseline mismatch: 4 develop commit(s) in the PR build are missing from the baseline. Their size changes also affect this comparison. Compare commits. Re-run once develop's baseline build for 90450a6 finishes.

Path Size % Change Change
@sentry/browser 30.39 kB - -
@sentry/browser - with treeshaking flags 28.53 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.42 kB - -
@sentry/browser (incl. Tracing) 52.7 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.71 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.68 kB - -
@sentry/browser (incl. Tracing, Replay) 93.01 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.75 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.74 kB - -
@sentry/browser (incl. Feedback) 47.97 kB - -
@sentry/browser (incl. sendFeedback) 35.49 kB - -
@sentry/browser (incl. FeedbackAsync) 40.6 kB - -
@sentry/browser (incl. Metrics) 31.42 kB - -
@sentry/browser (incl. Logs) 31.72 kB - -
@sentry/browser (incl. Metrics & Logs) 32.44 kB - -
@sentry/react 32.27 kB - -
@sentry/react (incl. Tracing) 55.07 kB - -
@sentry/vue 38.66 kB - -
@sentry/vue (incl. Tracing) 55.72 kB - -
@sentry/svelte 30.42 kB - -
@sentry/remix (Remix 3 client bundle) 57.79 kB - -
CDN Bundle 32.18 kB - -
CDN Bundle (incl. Tracing) 53.23 kB - -
CDN Bundle (incl. Logs, Metrics) 34.45 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.17 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.86 kB - -
CDN Bundle (incl. Tracing, Replay) 91.44 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.55 kB - -
CDN Bundle - uncompressed 94.62 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.58 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.09 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.31 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.65 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 284.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.69 kB - -
@sentry/nextjs (client) 57.87 kB - -
@sentry/sveltekit (client) 53.22 kB - -
@sentry/core/server 44.24 kB - -
@sentry/core/browser 13.93 kB - -
@sentry/node 154.94 kB +0.04% +59 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.08 kB - -
@sentry/node - without tracing 96.22 kB +0.03% +20 B 🔺
@sentry/node - without channel injection 135.33 kB +0.02% +25 B 🔺
@sentry/aws-serverless 104.42 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 197.91 kB +0.02% +27 B 🔺
@sentry/cloudflare (withSentry) 491.89 kB +0.01% +23 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 218.34 kB +0.02% +27 B 🔺

View base workflow run

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 30, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this 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.

Reviewed by Cursor Bugbot for commit dd6c217. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/server-utils/test/integrations/prisma.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 30, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 2 not successful, 50 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Failing after 31s Details
❌ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Failing after 2m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 19s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 19s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 25s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 18s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 25s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 46s Details
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mydea mydea changed the title ref(server-utils): Key SQL query helper result by attribute name feat(server-utils): Move to new getSqlQueryAttributes helper for consistency Oct 30, 2026
@mydea
mydea marked this pull request as ready for review October 30, 2026 09:22
@mydea
mydea requested review from a team as code owners October 30, 2026 09:22
@mydea
mydea requested review from andreiborza, chargome, isaacs and nicohrubec and removed request for a team October 30, 2026 09:22
@mydea
mydea force-pushed the ref/sql-query-attributes branch from 0abb0e0 to 1b427a1 Compare October 30, 2026 09:32
nicohrubec
nicohrubec approved these changes Oct 30, 2026
View reviewed changes

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nice cleanup

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mydea and others added 3 commits October 30, 2026 13:45
@mydea @claude
ref(server-utils): Key SQL query helper result by attribute name
8f41178
`sanitizeSqlQueryWithSummary` is now `getSqlQueryAttributes` and returns
`db.query.text`, `db.query.summary` and `db.operation.name` keyed by
their attribute names, so integrations spread it into span attributes.

The mysql2 diagnostics-channel subscriber and the Prisma tracing helper
now use it too. Prisma 5, which only reports `db.statement`, gains a
sanitized `db.query.text`; Prisma's own query text and operation name
are kept, while the summary is always derived by the SDK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mydea @claude
test(server-utils): Use convention constants for Prisma test attribut…
f234370
…e keys

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mydea @claude
ref(server-utils): Use getSqlQueryAttributes for postgres.js and te…
2067f0d
…dious

Both still sanitized and summarized queries by hand. postgres.js
reported the sanitizer's `Unknown SQL Query` placeholder as
`db.query.text` when there was no query, and derived the fallback
`db.operation.name` from its own regex of seven keywords; the server's
reported command still takes precedence once a query succeeds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mydea
mydea force-pushed the ref/sql-query-attributes branch from 1b427a1 to 2067f0d Compare October 30, 2026 12:45
@mydea
mydea merged commit 7aca628 into develop Oct 30, 2026
553 of 567 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mydea
mydea deleted the ref/sql-query-attributes branch October 30, 2026 13:15
mydea added a commit that referenced this pull request Nov 4, 2026
@mydea @claude
feat(server-utils): Extract getSqlSpanName for SQL span names (#25929)
4d85171
TLDR: This PR introduces a helper to build db span names based on[
semantic
conventions](https://getsentry.github.io/sentry-conventions/names/#db).
This should make it more consistent and easier to use this in the
future.

**Why:** We used to repeat more or less the same code in various places
for building span names. Most places have a branch for legacy
high-cardinality names (transactions) and low-cardinality names
(streamed spans). New utilities help with that. Note that new
integrations (like neon) should use the low-cardinality version only.

**How to review:** `getSqlSpanName` in `utils/sql.ts`, then skim the
callsites, which now build their attributes before naming the span.
Behavior changes, all limited to edge cases or improvements:

- **Knex** drops its custom fallbacks (operation/table/database). They
only applied to queries without SQL, which knex practically never
produces, and the operation and table stay on the span as attributes.
- **Nuxt**'s streamed fallback now uses `db.system.name` before
`'Database operation'`.
- **postgres.js** (diagnostics channel) sets its resolved connection
attributes at span start, so the namespace is available for the name.
- **Prisma** only routes `db_query` spans through the helper; every
other Prisma span keeps its own name, even when it carries db attributes
(e.g. v5's `prisma:engine:connection` has `db.system`). For `db_query`
spans:
  - Streamed names are unchanged (`db.query.summary` first).
- Non-streamed names on Prisma 5 now use the sanitized `db.query.text`
(backfilled in #25927) instead of the raw `db.statement`, so literals no
longer end up in span names, e.g. `… WHERE 1=1 …` becomes `… WHERE ?=?
…`. Prisma 6+ already uses Prisma's own `db.query.text`, so nothing
changes there.
- A streamed `db_query` span with no SQL at all would now fall back to
`db.namespace`/`db.system.name` before the Prisma span name. Prisma
doesn't emit query spans without SQL in practice.

**Unsure about:** Tedious keeps its own names on purpose (see the
comment there): bulk loads and procedure calls have no statement, and
operation-based names say more than the namespace.

Stacked on #25927.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Nov 5, 2026
publish: getsentry/[email protected] getsentry/publish#10234
Closed
51 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@nicohrubec nicohrubec nicohrubec approved these changes
@chargome chargome Awaiting requested review from chargome chargome was automatically assigned from getsentry/team-javascript-sdks-framework
@isaacs isaacs Awaiting requested review from isaacs isaacs was automatically assigned from getsentry/team-javascript-sdks-server
@andreiborza andreiborza Awaiting requested review from andreiborza andreiborza was automatically assigned from getsentry/team-javascript-sdks-server

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mydea @nicohrubec
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.