Skip to content

fix(server-utils): Require a parent span for Mongoose operations - #25856

Closed
lazerg wants to merge 1 commit into
getsentry:developfrom
lazerg:feat/mongoose-require-parent-span
Closed

lazerg wants to merge 1 commit into
getsentry:developfrom
lazerg:feat/mongoose-require-parent-span

Conversation

@lazerg

@lazerg lazerg commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Why: Skip automatic Mongoose DB spans when there is no parent span, since each one ends up as its own root span with no context, same as the other DB integrations.

How to review: The native channel subscriber (mongoose >= 9.7) passes requiresParentSpan: true. The orchestrion path (mongoose < 9.7) creates no span when there is neither a build-time parent nor an active span, so a query built inside a span but awaited outside it still parents to that span. The rest is regression coverage for both paths.

Closes #25799

@lazerg
lazerg requested a review from a team as a code owner October 29, 2026 06:56
@lazerg
lazerg requested review from andreiborza and isaacs and removed request for a team October 29, 2026 06:56
@github-actions github-actions Bot added the external PR from an external contributor label Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lazerg
lazerg force-pushed the feat/mongoose-require-parent-span branch from 34219b3 to 95a80a3 Compare October 29, 2026 07:28
@nicohrubec

Copy link
Copy Markdown
Member

after some more internal discussion on the approach for this I'll close this down as superseded by #25879

@nicohrubec nicohrubec closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only create mongoose db spans when there is a parent span

2 participants