Repository navigation
feat(server-utils): Move to new getSqlQueryAttributes helper for consistency - #25927
Merged
Merged
Conversation
This was referenced Oct 30, 2026
Contributor
size-limit report 📦Compared: 173afee (PR test merge using develop at 90450a6) Against: 2f5a2f9 (develop) · base run #64409
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 50 successful. See the run.
Successful checks
|
getSqlQueryAttributes helper for consistency
mydea
marked this pull request as ready for review
October 30, 2026 09:22
mydea
requested review from
andreiborza,
chargome,
isaacs and
nicohrubec
and removed request for
a team
October 30, 2026 09:22
mydea
force-pushed
the
ref/sql-query-attributes
branch
from
October 30, 2026 09:32
0abb0e0 to
1b427a1
Compare
`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 <noreply@anthropic.com>
…e keys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
mydea
force-pushed
the
ref/sql-query-attributes
branch
from
October 30, 2026 12:45
1b427a1 to
2067f0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Why:
sanitizeSqlQueryWithSummarygrew a third value withdb.operation.name, and every SQL integration copied the result into the same three attributes by hand.getSqlQueryAttributesreturns 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 theirdb.operation.namekeeps 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'sUnknown SQL Queryplaceholder asdb.query.textwhen there is no query; its publicrequestHookgets''in that case.How to review: Start with
utils/sql.ts, then the Prisma tracing helper. Prisma keeps its owndb.query.text/db.operation.nameand only falls back to ours;db.query.summaryis always ours, so the streamed span name stays dialect-aware across Prisma versions. Prisma 5 only reportsdb.statement, so its spans now also get a sanitizeddb.query.text(see the v5 test). Tedious clears the summary and operation name for procedure calls, as before.Unsure about:
@sentry/server-utilsexports 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