Skip to content

ref(core/opentelemetry): Set low cardinality db span names when span streaming is enabled#21599

Draft
Lms24 wants to merge 2 commits into
developfrom
lms/ref-core-db-span-names
Draft

ref(core/opentelemetry): Set low cardinality db span names when span streaming is enabled#21599
Lms24 wants to merge 2 commits into
developfrom
lms/ref-core-db-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Adds low cardinality span name construction to the database span name inferral logic our SDK applies to OTel-generated spans. This is likely something we can in the future pull into individual instrumentations but as long all spans go through parseSpanDescription it's the easiest place to add the logic to.

Concrete changes:

  • Adds a buildSpanName helper to core that takes string templates and a data object from which to find the first matching span name. This is heavily inspired by span name rules in Sentry conventions and the templates are an almost exact copy of the ones for db spans in conventions.
    • This is likely overkill for "just" DB spans but we'll add more such logic to other spans. I'm keeping this PR as a draft until I have confirmation for this list. I think in the long-run, the template-based approach outweighs the bundle size footprint of a bunch of branch statements depending on attribute availability.
  • uses new buildSpanName utility on db span inference logic IFF span streaming is enabled
  • adds unit tests for utility and db span inference

Comment thread packages/core/src/utils/spanNames.ts Fixed
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.4 kB - -
@sentry/browser - with treeshaking flags 25.84 kB - -
@sentry/browser (incl. Tracing) 45.7 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.94 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.5 kB - -
@sentry/browser (incl. Tracing, Replay) 84.92 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.53 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.61 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.3 kB - -
@sentry/browser (incl. Feedback) 44.56 kB - -
@sentry/browser (incl. sendFeedback) 32.2 kB - -
@sentry/browser (incl. FeedbackAsync) 37.31 kB - -
@sentry/browser (incl. Metrics) 28.47 kB - -
@sentry/browser (incl. Logs) 28.71 kB - -
@sentry/browser (incl. Metrics & Logs) 29.4 kB - -
@sentry/react 29.2 kB - -
@sentry/react (incl. Tracing) 48 kB - -
@sentry/vue 32.42 kB - -
@sentry/vue (incl. Tracing) 47.59 kB - -
@sentry/svelte 27.42 kB - -
CDN Bundle 29.79 kB - -
CDN Bundle (incl. Tracing) 48.2 kB - -
CDN Bundle (incl. Logs, Metrics) 31.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.49 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.62 kB - -
CDN Bundle (incl. Tracing, Replay) 85.52 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.62 kB - -
CDN Bundle - uncompressed 88.59 kB - -
CDN Bundle (incl. Tracing) - uncompressed 145.8 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.29 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.77 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.12 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.67 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.31 kB - -
@sentry/nextjs (client) 50.45 kB - -
@sentry/sveltekit (client) 46.12 kB - -
@sentry/core/server 76.18 kB +0.15% +108 B 🔺
@sentry/core/browser 63.33 kB +0.18% +110 B 🔺
@sentry/node-core 62.03 kB +0.51% +312 B 🔺
@sentry/node 128.92 kB +0.2% +253 B 🔺
@sentry/node - without tracing 74.39 kB +0.39% +284 B 🔺
@sentry/aws-serverless 85.61 kB +0.32% +267 B 🔺
@sentry/cloudflare (withSentry) - minified 174.19 kB - -
@sentry/cloudflare (withSentry) 435.41 kB - -

View base workflow run

@Lms24 Lms24 changed the title ref(core/opentelemetry): Set low cardinality span names when span streaming is enabled ref(core/opentelemetry): Set low cardinality db span names when span streaming is enabled Jun 17, 2026
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.

2 participants