Skip to content

feat(server-utils): Emit low cardinality mongoose db span names - #23782

Merged
Lms24 merged 2 commits into
developfrom
lms/feat-core-mongoose-low-card-span-names
Sep 2, 2026
Merged

feat(server-utils): Emit low cardinality mongoose db span names#23782
Lms24 merged 2 commits into
developfrom
lms/feat-core-mongoose-low-card-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Aug 31, 2026

Copy link
Copy Markdown
Member

With span streaming enabled:

  • mongoose spans become {db.operation.name} {db.collection.name}, e.g. findOne blogposts
  • falls back to db.namespace, then to db.system.name
  • the model name (BlogPost) is no longer part of the name — the conventions template uses db.collection.name (blogposts), which is what both mongoose paths already set
  • traceLifecycle: 'static' keeps the existing mongoose.<Model>.<op> names

Also corrects db.system.name on the monkey-patch path from mongoose to mongodb. mongoose is not a database system, and the diagnostics-channel path already emitted mongodb.

Added streaming node-integration tests for all mongoose test suites.

Refs #23523

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.94 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.83 kB - -
@sentry/browser (incl. Tracing) 48.87 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.88 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.8 kB - -
@sentry/browser (incl. Tracing, Replay) 88.36 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.76 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.05 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.02 kB - -
@sentry/browser (incl. Feedback) 46.06 kB - -
@sentry/browser (incl. sendFeedback) 33.64 kB - -
@sentry/browser (incl. FeedbackAsync) 38.74 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.81 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.32 kB - -
@sentry/react (incl. Tracing) 51.08 kB - -
@sentry/vue 35.74 kB - -
@sentry/vue (incl. Tracing) 51.14 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.36 kB - -
CDN Bundle (incl. Tracing) 49.52 kB - -
CDN Bundle (incl. Logs, Metrics) 32.59 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.43 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.19 kB - -
CDN Bundle (incl. Tracing, Replay) 87.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.88 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.84 kB - -
CDN Bundle - uncompressed 89.97 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.58 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.27 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.43 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.07 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.44 kB - -
@sentry/nextjs (client) 53.7 kB - -
@sentry/sveltekit (client) 49.3 kB - -
@sentry/core/server 40.74 kB - -
@sentry/core/browser 13.42 kB - -
@sentry/node 123.92 kB +0.06% +68 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.4 kB - -
@sentry/node - without tracing 88.2 kB +0.03% +22 B 🔺
@sentry/node - without channel injection 103.35 kB +0.07% +65 B 🔺
@sentry/aws-serverless 96.56 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 201.23 kB - -
@sentry/cloudflare (withSentry) 500.94 kB - -

View base workflow run

@Lms24 Lms24 self-assigned this Aug 31, 2026
@Lms24
Lms24 force-pushed the lms/feat-core-mongoose-low-card-span-names branch from 9290d85 to 797e077 Compare August 31, 2026 16:55
@Lms24
Lms24 marked this pull request as ready for review August 31, 2026 16:55
@Lms24
Lms24 requested review from a team as code owners August 31, 2026 16:55
@Lms24
Lms24 requested review from isaacs and mydea and removed request for a team August 31, 2026 16:55
@Lms24 Lms24 changed the title feat(core): Emit low cardinality mongoose span names feat(core): Emit low cardinality mongoose db span names Aug 31, 2026

@chargome chargome 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.

Migration still needs an update for this, we should also point out that this also changes db.system.name for static.

Also logaf-L: PR title should be feat(server-utils)!:

@Lms24 Lms24 changed the title feat(core): Emit low cardinality mongoose db span names feat(server-utils)!: Emit low cardinality mongoose db span names Sep 2, 2026
@Lms24 Lms24 changed the title feat(server-utils)!: Emit low cardinality mongoose db span names feat(server-utils): Emit low cardinality mongoose db span names Sep 2, 2026
Lms24 and others added 2 commits September 2, 2026 10:27
Mongoose spans wrap an ODM-level operation. With span streaming enabled:

- mongoose spans become `{db.operation.name} {db.collection.name}`, e.g.
  `findOne blogposts`
- falls back to `db.namespace`, then to `db.system.name`
- `traceLifecycle: 'static'` keeps the existing `mongoose.<Model>.<op>` names

Also corrects `db.system.name` on the monkey-patch path from `mongoose` to
`mongodb`, matching the diagnostics-channel path.

Refs #23523

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add the mongoose row to the v11 span name table and note that the
`db.system.name` change from `mongoose` to `mongodb` applies in both
trace lifecycles, not just with span streaming.

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/feat-core-mongoose-low-card-span-names branch from 81f6ac7 to 31f82da Compare September 2, 2026 08:28
@Lms24
Lms24 enabled auto-merge (squash) September 2, 2026 08:28
@Lms24
Lms24 merged commit e2ff7c7 into develop Sep 2, 2026
212 checks passed
@Lms24
Lms24 deleted the lms/feat-core-mongoose-low-card-span-names branch September 2, 2026 08:41
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