Skip to content

fix(core): Reparent spans started under an ignored child span - #26801

Merged
RulaKhaled merged 5 commits into
developfrom
fix/with-active-span-ignored-child
Dec 1, 2026
Merged

RulaKhaled merged 5 commits into
developfrom
fix/with-active-span-ignored-child

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

Spans whose parent is an ignored child span (ignoreSpans with span streaming) are no longer dropped. This covers spans started inside withActiveSpan(ignoredSpan, ...) and spans passed parentSpan: ignoredSpan in startSpan, startSpanManual and startInactiveSpan. They are parented to the ignored span's parent, as startSpan already did for nested calls, and outgoing requests propagate that parent with -1 instead of the ignored span's ID with -0.

Why

The spec says children of an ignored child span must be reparented to its parent. Until now each integration had to guard for this itself. The tracing channel helper, Prisma and LangChain each checked spanIsIgnored(span) && getRootSpan(span) !== span before activating a span, and integrations without that check lost the whole subtree. Ignoring gen_ai.invoke_agent dropped every tool and HTTP span under Anthropic's tool runner. Ignoring gen_ai.execute_tool dropped the spans started inside a Flue tool and every pi-durable subagent run. This moves the rule into core and removes the three guards, so every integration gets it.

Core stores the parent when it creates the ignored span instead of reading the active span later, because Flue and pi-durable resume spans from a background loop whose active span belongs to another request. Inside the callback, getActiveSpan() now returns the parent. Ignored segments are unchanged and still drop their subtree. Trace headers built directly from an ignored span with getTraceData({ span }) still carry its ID with -0. That's a follow-up.

Closes: #25389

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: f02b78b (PR test merge using develop at 2f0cf3f)

Against: 6f6ed97 (develop) · base run #68498

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.58 kB - -
@sentry/browser - with treeshaking flags 28.76 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.63 kB - -
@sentry/browser (incl. Tracing) 53.77 kB +0.11% +55 B 🔺
@sentry/browser (incl. Tracing Core) 40.69 kB +0.11% +43 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 53.77 kB +0.11% +54 B 🔺
@sentry/browser (incl. Tracing, Profiling) 56.66 kB +0.11% +57 B 🔺
@sentry/browser (incl. Tracing, Replay) 93.7 kB +0.07% +61 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.48 kB +0.06% +46 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 98.56 kB +0.08% +69 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 111.51 kB +0.06% +62 B 🔺
@sentry/browser (incl. Feedback) 48.43 kB - -
@sentry/browser (incl. sendFeedback) 31.15 kB - -
@sentry/browser (incl. FeedbackAsync) 36.2 kB - -
@sentry/browser (incl. Metrics) 31.9 kB - -
@sentry/browser (incl. Logs) 32.18 kB - -
@sentry/browser (incl. Metrics & Logs) 32.84 kB - -
@sentry/react 32.6 kB - -
@sentry/react (incl. Tracing) 56.52 kB +0.12% +67 B 🔺
@sentry/vue 38.83 kB +0.13% +48 B 🔺
@sentry/vue (incl. Tracing) 56.8 kB +0.1% +53 B 🔺
@sentry/svelte 30.61 kB - -
@sentry/effect (client) 42.27 kB - -
@sentry/effect (client, incl. Tracing) 55.06 kB +0.1% +50 B 🔺
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.4 kB +0.09% +59 B 🔺
@sentry/remix (Remix 3 client bundle) 59.49 kB +0.06% +30 B 🔺
CDN Bundle 32.42 kB +0.07% +20 B 🔺
CDN Bundle (incl. Tracing) 54.12 kB +0.07% +35 B 🔺
CDN Bundle (incl. Logs, Metrics) 35.18 kB +0.06% +18 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 56.58 kB +0.07% +35 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 76.14 kB +0.03% +21 B 🔺
CDN Bundle (incl. Tracing, Replay) 91.94 kB +0.08% +65 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.45 kB +0.05% +47 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 97.39 kB +0.04% +36 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.86 kB +0.05% +42 B 🔺
CDN Bundle - uncompressed 94.7 kB +0.07% +58 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 160.06 kB +0.07% +96 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 103.04 kB +0.06% +58 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.68 kB +0.06% +96 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.43 kB +0.03% +58 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.49 kB +0.04% +96 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.12 kB +0.04% +96 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.43 kB +0.04% +96 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300.04 kB +0.04% +96 B 🔺
@sentry/nextjs (client) 60.32 kB +0.09% +53 B 🔺
@sentry/sveltekit (client) 55.13 kB +0.1% +54 B 🔺
@sentry/astro (client) - rolldown, without tracing 39.51 kB - -
@sentry/core/server 45.96 kB +0.13% +57 B 🔺
@sentry/core/browser 14.54 kB +0.32% +46 B 🔺
@sentry/node 157.97 kB -0.01% -4 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.6 kB - -
@sentry/node - without tracing 90.02 kB +0.03% +24 B 🔺
@sentry/node - without channel injection 146.92 kB -0.02% -23 B 🔽
@sentry/aws-serverless 100.7 kB +0.06% +51 B 🔺
@sentry/cloudflare (withSentry) - minified 212.63 kB +0.07% +129 B 🔺
@sentry/cloudflare (withSentry) 493.12 kB +0.09% +439 B 🔺
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 215.58 kB +0.06% +129 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 238.06 kB +0.06% +129 B 🔺

View base workflow run

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 64 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Failing after 4m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E hono-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 (bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 2m Details

@Lms24
Lms24 self-requested a review November 24, 2026 11:00
@RulaKhaled RulaKhaled self-assigned this Nov 25, 2026
@RulaKhaled
RulaKhaled marked this pull request as ready for review November 25, 2026 18:22

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

Thanks for fixing! I think the approach is correct and the most efficient thing we can do. Noticed that the scope of the PR is slightly wider than withActiveSpan though, so let's can adjust the PR for that.

Comment thread packages/core/src/tracing/trace.ts Resolved
Comment thread packages/core/src/tracing/trace.ts Resolved
Comment thread packages/core/src/tracing/trace.ts Resolved
Comment thread packages/core/src/tracing/trace.ts Resolved
@RulaKhaled RulaKhaled changed the title fix(core): Activate the parent of an ignored child span in withActiveSpan fix(core): Reparent spans started under an ignored child span Nov 30, 2026
@RulaKhaled
RulaKhaled enabled auto-merge (squash) November 30, 2026 18:41
RulaKhaled and others added 5 commits December 1, 2026 20:36
…Span

withActiveSpan made an ignored child span active, so every span started in the
callback was dropped with it. Core now stores the ignored child's parent when it
creates the span, and withActiveSpan and parentSpan resolve to that parent, as
startSpan already does.

Closes #25389

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…span

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l spans

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename getEmittedSpan to getSpanOrUnignoredParent, shorten the comments,
and cover startSpan with an ignored child passed as parentSpan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RulaKhaled
RulaKhaled force-pushed the fix/with-active-span-ignored-child branch from 5db62e4 to 1ec1776 Compare December 1, 2026 20:39
@RulaKhaled
RulaKhaled merged commit b782a90 into develop Dec 1, 2026
522 of 523 checks passed
@RulaKhaled
RulaKhaled deleted the fix/with-active-span-ignored-child branch December 1, 2026 20:44
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.

Integrations that call withActiveSpan on an ignored child span drop its whole subtree

2 participants