Skip to content

fix(cloudflare): Require a parent span for storage and D1 operations - #25860

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

lazerg wants to merge 1 commit into
getsentry:developfrom
lazerg:fix/cloudflare-require-parent-span

Conversation

@lazerg

@lazerg lazerg commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Why: D1, KV, Durable Object storage and SqlStorage calls made outside any active span each became their own root span with no context. They now pass onlyIfParent: true to startSpan, so they only create a span inside an existing trace, like the other db integrations.

How to review: The fix is the onlyIfParent: true option in the five instrumentations. Each test file gets a test that runs one call outside and one inside a parent span and checks that only the one inside creates a span. The existing exact-match assertions needed the new option too.

Unsure about: The SqlStorage fast path (childSpanWillNotBeRecorded) still treats a missing active span as recording, so a query outside a span is sanitized before its span is dropped. I left it as is to keep the change small, happy to move it into the fast path if you prefer.

Closes #25804

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the external PR from an external contributor label Oct 29, 2026
@lazerg
lazerg marked this pull request as ready for review October 29, 2026 07:27
@lazerg
lazerg requested a review from a team as a code owner October 29, 2026 07:27
@lazerg
lazerg requested review from andreiborza and isaacs and removed request for a team October 29, 2026 07:27
@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 Cloudflare storage and D1 db spans when there is a parent span

2 participants