Skip to content

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

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

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

@Lms24Lms24 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 threadpackages/core/src/utils/spanNames.ts Fixed
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.4 kB--
@sentry/browser - with treeshaking flags25.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 flags74.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/react29.2 kB--
@sentry/react (incl. Tracing)48 kB--
@sentry/vue32.42 kB--
@sentry/vue (incl. Tracing)47.59 kB--
@sentry/svelte27.42 kB--
CDN Bundle29.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 - uncompressed88.59 kB--
CDN Bundle (incl. Tracing) - uncompressed145.8 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed93.29 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed149.77 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed218.12 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed264.67 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed268.63 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed278.37 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed282.31 kB--
@sentry/nextjs (client)50.45 kB--
@sentry/sveltekit (client)46.12 kB--
@sentry/core/server76.18 kB+0.15%+108 B 🔺
@sentry/core/browser63.33 kB+0.18%+110 B 🔺
@sentry/node-core62.03 kB+0.51%+312 B 🔺
@sentry/node128.92 kB+0.2%+253 B 🔺
@sentry/node - without tracing74.39 kB+0.39%+284 B 🔺
@sentry/aws-serverless85.61 kB+0.32%+267 B 🔺
@sentry/cloudflare (withSentry) - minified174.19 kB--
@sentry/cloudflare (withSentry)435.41 kB--

View base workflow run

@Lms24Lms24 changed the title ref(core/opentelemetry): Set low cardinality span names when span streaming is enabledref(core/opentelemetry): Set low cardinality db span names when span streaming is enabledJun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you apply the label PR: no-auto-close I will leave it alone ... forever!

@Lms24

Lms24 commented Jul 9, 2026

Copy link
Copy Markdown
MemberAuthor

gonna close, this likely needs a complete rework once we get to span name adjustments

@Lms24Lms24 closed this Jul 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Lms24@github-advanced-security