Skip to content

feat(cloudflare)!: Emit low cardinality D1 db span names - #23604

Draft
Lms24 wants to merge 1 commit into
developfrom
lms/feat-cloudflare-low-card-db-span-names5
Draft

feat(cloudflare)!: Emit low cardinality D1 db span names#23604
Lms24 wants to merge 1 commit into
developfrom
lms/feat-cloudflare-low-card-db-span-names5

Conversation

@Lms24

@Lms24 Lms24 commented Aug 25, 2026

Copy link
Copy Markdown
Member

With span streaming enabled:

  • D1 query spans are named after db.query.summary
  • e.g. SELECT * FROM users WHERE id = ? becomes SELECT users
  • no namespace or server to pair with, so falls back to db.system.name
  • new db.query.summary attribute, set in both trace lifecycles
  • statement is sanitized before summarizing, so literals cannot leak
  • batch spans keep their name; their text is many statements
  • traceLifecycle: 'static' keeps the existing names

Refs #23523

With span streaming, D1 query spans are named after their `db.query.summary`
(`SELECT users`) 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.

D1 exposes no collection, namespace or server to pair the operation with, so a
statement that cannot be summarized falls back to `db.system.name`. `batch`
spans keep their name and get no summary, since their `db.query.text` is several
statements joined together.

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

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.55 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.57 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.47 kB - -
@sentry/browser (incl. Tracing, Replay) 88 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.44 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.69 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.41 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.47 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.33 kB - -
@sentry/react (incl. Tracing) 50.76 kB - -
@sentry/vue 35.64 kB - -
@sentry/vue (incl. Tracing) 50.78 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.32 kB - -
CDN Bundle (incl. Tracing) 49.07 kB - -
CDN Bundle (incl. Logs, Metrics) 32.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.94 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.96 kB - -
CDN Bundle (incl. Tracing, Replay) 86.57 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.27 kB - -
CDN Bundle - uncompressed 89.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.74 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.43 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.3 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.14 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.84 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.51 kB - -
@sentry/nextjs (client) 53.27 kB - -
@sentry/sveltekit (client) 48.97 kB - -
@sentry/core/server 65.11 kB - -
@sentry/core/browser 52.27 kB - -
@sentry/node 121.58 kB +0.02% +19 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB - -
@sentry/node - without tracing 87.46 kB +0.03% +24 B 🔺
@sentry/aws-serverless 95.85 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 199.37 kB +0.05% +90 B 🔺
@sentry/cloudflare (withSentry) 495.71 kB +0.06% +281 B 🔺

View base workflow run

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