Skip to content

feat(server-utils): Emit low cardinality knex, tedious and prisma db span names - #23602

Merged
Lms24 merged 10 commits into
developfrom
lms/feat-server-utils-low-card-db-span-names3
Sep 2, 2026
Merged

feat(server-utils): Emit low cardinality knex, tedious and prisma db span names#23602
Lms24 merged 10 commits into
developfrom
lms/feat-server-utils-low-card-db-span-names3

Conversation

@Lms24

@Lms24 Lms24 commented Aug 25, 2026

Copy link
Copy Markdown
Member

With span streaming enabled:

  • knex, prisma and tedious spans are named after db.query.summary, with fallbacks according to lower prio sentry convention name templates
  • traceLifecycle: 'static' keeps the existing names

Also discovered some bugs along the way that should be addressed afterwards but don't belong into this PR:

Refs #23523

Comment thread packages/server-utils/src/integrations/knex.ts
Comment thread packages/server-utils/src/integrations/knex.ts Outdated
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB -4.23% -1.26 kB 🔽
@sentry/browser - with treeshaking flags 26.94 kB -3.9% -1.09 kB 🔽
@sentry/browser (incl. Tracing) 48.87 kB +3.44% +1.62 kB 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.88 kB +3.4% +1.6 kB 🔺
@sentry/browser (incl. Tracing, Profiling) 51.8 kB -0.38% -197 B 🔽
@sentry/browser (incl. Tracing, Replay) 88.36 kB +2.05% +1.77 kB 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.76 kB +2.32% +1.76 kB 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 93.05 kB +1.94% +1.77 kB 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 106.02 kB +1.99% +2.06 kB 🔺
@sentry/browser (incl. Feedback) 46.06 kB -2.28% -1.07 kB 🔽
@sentry/browser (incl. sendFeedback) 33.64 kB -2.98% -1.03 kB 🔽
@sentry/browser (incl. FeedbackAsync) 38.74 kB -2.61% -1.03 kB 🔽
@sentry/browser (incl. Metrics) 29.52 kB -4.48% -1.38 kB 🔽
@sentry/browser (incl. Logs) 29.81 kB -4.29% -1.33 kB 🔽
@sentry/browser (incl. Metrics & Logs) 30.45 kB -4.3% -1.37 kB 🔽
@sentry/react 30.32 kB -4.15% -1.31 kB 🔽
@sentry/react (incl. Tracing) 51.08 kB +3.17% +1.57 kB 🔺
@sentry/vue 35.74 kB +2.35% +819 B 🔺
@sentry/vue (incl. Tracing) 51.14 kB +3.87% +1.9 kB 🔺
@sentry/svelte 28.6 kB -4.21% -1.25 kB 🔽
CDN Bundle 30.36 kB -4.75% -1.51 kB 🔽
CDN Bundle (incl. Tracing) 49.52 kB +4.16% +1.98 kB 🔺
CDN Bundle (incl. Logs, Metrics) 32.59 kB -2.46% -819 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 51.43 kB +5.07% +2.48 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.19 kB +0.61% +439 B 🔺
CDN Bundle (incl. Tracing, Replay) 87.01 kB +2.15% +1.83 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.88 kB +2.75% +2.38 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 92.94 kB +2.13% +1.93 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.84 kB +2.74% +2.53 kB 🔺
CDN Bundle - uncompressed 89.97 kB -4.92% -4.65 kB 🔽
CDN Bundle (incl. Tracing) - uncompressed 147.58 kB +3.85% +5.46 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.27 kB -3% -2.98 kB 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.27 kB +4.91% +7.17 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.43 kB +0.67% +1.49 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.07 kB +2.18% +5.7 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.75 kB +2.8% +7.41 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.77 kB +2.07% +5.69 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.44 kB +2.66% +7.4 kB 🔺
@sentry/nextjs (client) 53.7 kB +3.11% +1.62 kB 🔺
@sentry/sveltekit (client) 49.3 kB +3.35% +1.59 kB 🔺
@sentry/core/server 40.74 kB -37.82% -24.78 kB 🔽
@sentry/core/browser 13.42 kB -74.13% -38.46 kB 🔽
@sentry/node 123.96 kB +3.1% +3.72 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.4 kB added added
@sentry/node - without tracing 88.2 kB +5.4% +4.51 kB 🔺
@sentry/aws-serverless 96.56 kB +4.56% +4.21 kB 🔺
@sentry/cloudflare (withSentry) - minified 201.23 kB -7.97% -17.42 kB 🔽
@sentry/cloudflare (withSentry) 500.94 kB -7.04% -37.9 kB 🔽
@sentry/browser - with treeshaking flags tracing without tracing 26.83 kB added added
@sentry/node - without channel injection 103.39 kB added added

View base workflow run

Comment thread dev-packages/node-integration-tests/suites/tracing/tedious/test.ts
@Lms24 Lms24 self-assigned this Aug 27, 2026
@Lms24 Lms24 changed the title feat(server-utils)!: Emit low cardinality knex, tedious and prisma db span names feat(server-utils): Emit low cardinality knex, tedious and prisma db span names Aug 27, 2026
@Lms24
Lms24 force-pushed the lms/feat-server-utils-low-card-db-span-names3 branch from acc75d0 to 340500e Compare August 28, 2026 10:58
@Lms24
Lms24 marked this pull request as ready for review August 28, 2026 11:26
@Lms24
Lms24 requested review from a team as code owners August 28, 2026 11:26
@Lms24
Lms24 requested review from JPeer264 and isaacs and removed request for a team August 28, 2026 11:26
Comment thread packages/server-utils/src/integrations/tedious.ts Outdated
Comment thread packages/server-utils/src/integrations/tedious.ts Outdated

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This mostly LGTM, with some minor comments. The only concern I'd really worry about is to merge in the upstream and make sure that we're setting the dialect when sanitizing the SQL query.

Comment thread packages/server-utils/src/integrations/tedious.ts Outdated
Comment thread packages/server-utils/src/integrations/knex.ts Outdated
Comment thread packages/server-utils/src/integrations/knex.ts
Comment thread dev-packages/node-integration-tests/suites/tracing/knex/pg/test.ts
Comment thread packages/server-utils/src/integrations/tedious.ts Outdated
@Lms24
Lms24 force-pushed the lms/feat-server-utils-low-card-db-span-names3 branch from 0e97042 to 97f126b Compare August 31, 2026 09:04

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 97f126b. Configure here.

Comment thread packages/server-utils/src/integrations/prisma/tracing-helper.ts
@Lms24
Lms24 force-pushed the lms/feat-server-utils-low-card-db-span-names3 branch from 97f126b to 428c3bf Compare September 1, 2026 07:44
@isaacs
isaacs self-requested a review September 2, 2026 03:29

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All concerns addressed!

Lms24 and others added 9 commits September 2, 2026 09:18
… span names

With span streaming, these three name their query spans from the span name
conventions instead of the SQL statement. They are grouped because each needs a
different fallback: knex drops to its existing `{operation} {namespace}.{table}`,
tedious has no statement to summarize and keeps `getSpanName`, and prisma resolves
its statement from either `db.statement` or `db.query.text` depending on version.

knex and prisma also report the new `db.query.summary` attribute.

`traceLifecycle: 'static'` keeps the existing names.

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…v7 streaming test

The Prisma v7 span-streaming test filtered query spans on `auto.db.otel.prisma`,
which #23627 renamed to `auto.db.prisma`. The filter matched nothing, so the
assertion threw — and because the test runs `.unordered()`, `newEnvelope` swallows
assertion errors and keeps waiting for another envelope, turning it into an opaque
75s timeout rather than a diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/feat-server-utils-low-card-db-span-names3 branch from 428c3bf to 2ac512a Compare September 2, 2026 07:18
@Lms24
Lms24 merged commit add9adb into develop Sep 2, 2026
212 checks passed
@Lms24
Lms24 deleted the lms/feat-server-utils-low-card-db-span-names3 branch September 2, 2026 12:52
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.

3 participants