feat(server-utils)!: Emit low cardinality postgres db span names - #23600
Merged
Conversation
With span streaming, `pg` and `postgres.js` query spans are named after their `db.query.summary` (`SELECT "User"`) instead of the full SQL statement, and report that summary as a new `db.query.summary` attribute. The statement is sanitized before it is summarized, so a string literal containing `from`/`join` cannot leak a value into the name. `traceLifecycle: 'static'` keeps the existing names. Refs #23523 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5f7d0d4. Configure here.
Contributor
size-limit report 📦
|
Lms24
marked this pull request as ready for review
August 26, 2026 10:28
Lms24
requested review from
JPeer264 and
isaacs
and removed request for
a team
August 26, 2026 10:28
JPeer264
approved these changes
Aug 26, 2026
| ...getConnectionAttributes(params), | ||
| [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, | ||
| [DB_QUERY_TEXT]: queryConfig?.text || undefined, | ||
| [DB_QUERY_SUMMARY]: querySummary, |
Lms24
enabled auto-merge (squash)
August 26, 2026 11:40
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.

This PR sets a low cardinality span name on postgres (
pgandpostgres.js) spans when span streaming is enabled.Concrete changes:
"postgres")SELECT * FROM "User" WHERE id = $1becomesSELECT "User"db.query.summaryattribute_setOperationNameto_getOperationNameand_setConnectionAttributesto_getConnectionAttributes. Both are exported from Core so these are breaking changes but they're prefixed with_INTERNALand we're only doing this for v11. So I think this should be fine. Marked the PR with a!for correctness.postgres.jsspans (pgalready has streaming tests)Refs #23523