Skip to content

WIP feat(opentelemetry): Add SentryTraceProvider#21181

Draft
andreiborza wants to merge 9 commits into
developfrom
ab/sentry-tracer-provider
Draft

WIP feat(opentelemetry): Add SentryTraceProvider#21181
andreiborza wants to merge 9 commits into
developfrom
ab/sentry-tracer-provider

Conversation

@andreiborza
Copy link
Copy Markdown
Member

WIP

Comment thread packages/opentelemetry/src/sentryTraceProvider.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.21 kB - -
@sentry/browser - with treeshaking flags 25.65 kB - -
@sentry/browser (incl. Tracing) 45.66 kB +0.35% +157 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.9 kB +0.36% +169 B 🔺
@sentry/browser (incl. Tracing, Profiling) 50.43 kB +0.29% +142 B 🔺
@sentry/browser (incl. Tracing, Replay) 84.88 kB +0.21% +172 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.47 kB +0.18% +133 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 89.57 kB +0.19% +168 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 102.26 kB +0.15% +153 B 🔺
@sentry/browser (incl. Feedback) 44.36 kB - -
@sentry/browser (incl. sendFeedback) 32.02 kB - -
@sentry/browser (incl. FeedbackAsync) 37.11 kB - -
@sentry/browser (incl. Metrics) 28.28 kB - -
@sentry/browser (incl. Logs) 28.52 kB - -
@sentry/browser (incl. Metrics & Logs) 29.22 kB - -
@sentry/react 29.02 kB - -
@sentry/react (incl. Tracing) 47.93 kB +0.33% +154 B 🔺
@sentry/vue 32.35 kB +0.41% +131 B 🔺
@sentry/vue (incl. Tracing) 47.54 kB +0.3% +141 B 🔺
@sentry/svelte 27.23 kB - -
CDN Bundle 29.61 kB +0.11% +30 B 🔺
CDN Bundle (incl. Tracing) 48.13 kB +0.38% +180 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.11 kB +0.1% +29 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.38 kB +0.38% +184 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 70.39 kB +0.04% +24 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.48 kB +0.18% +151 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.69 kB +0.2% +173 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.34 kB +0.21% +183 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.51 kB +0.2% +178 B 🔺
CDN Bundle - uncompressed 87.75 kB +0.06% +50 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 145.57 kB +0.47% +675 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 92.24 kB +0.06% +50 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.33 kB +0.46% +675 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 217.05 kB +0.03% +50 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.44 kB +0.26% +679 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.19 kB +0.26% +679 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.14 kB +0.25% +679 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 281.88 kB +0.25% +679 B 🔺
@sentry/nextjs (client) 50.4 kB +0.29% +142 B 🔺
@sentry/sveltekit (client) 46.08 kB +0.34% +152 B 🔺
@sentry/core/server 76 kB +0.09% +64 B 🔺
@sentry/core/browser 63.16 kB +0.12% +70 B 🔺
@sentry/node-core 61.88 kB +0.3% +182 B 🔺
@sentry/node 131.56 kB +0.89% +1.16 kB 🔺
@sentry/node - without tracing 75.15 kB +1.45% +1.07 kB 🔺
@sentry/aws-serverless 87.44 kB +1.36% +1.17 kB 🔺
@sentry/cloudflare (withSentry) - minified 174.42 kB +0.49% +834 B 🔺
@sentry/cloudflare (withSentry) 435.87 kB +0.5% +2.13 kB 🔺

View base workflow run

@andreiborza andreiborza force-pushed the ab/sentry-tracer-provider branch from 0f2020a to 71e7c69 Compare May 27, 2026 05:27
Comment thread packages/core/src/tracing/sentrySpan.ts Outdated
*/
public recordException(_exception: unknown, _time?: number | undefined): void {
// noop
public recordException(exception: unknown, time?: SpanTimeInput | undefined): void {
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.

I think we can leave this as noop, we do not care about this and do not really support it, doing nothing with events etc.

@andreiborza andreiborza force-pushed the ab/sentry-tracer-provider branch from 71e7c69 to a44215e Compare May 28, 2026 04:15
Comment thread packages/opentelemetry/src/sentryTraceProvider.ts
# Conflicts:
#	dev-packages/e2e-tests/test-applications/nextjs-13/instrumentation.ts
#	dev-packages/e2e-tests/test-applications/nextjs-14/instrumentation.ts
#	dev-packages/e2e-tests/test-applications/nextjs-15-basepath/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-15-intl/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-15/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16-cacheComponents/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16-streaming/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16-trailing-slash/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16-tunnel/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16-userfeedback/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-16/sentry.server.config.ts
#	dev-packages/e2e-tests/test-applications/nextjs-app-dir/instrumentation.ts
#	dev-packages/e2e-tests/test-applications/nextjs-pages-dir/instrumentation.ts
#	dev-packages/e2e-tests/test-applications/supabase-nextjs/sentry.server.config.ts
Comment thread packages/node/src/sdk/initOtel.ts
Comment thread packages/opentelemetry/src/sentryTraceProvider.ts
SentryNonRecordingSpan can now store a `sampled` flag that distinguishes
"sampled negative" from "no sampling decision yet" in TwP mode. Trace
header generation uses the new `spanToTraceSamplingDecision` helper to
propagate this decision instead of always inferring from traceFlags.

Also aligns `recordException` signature to use `SpanTimeInput` on both
the Span interface and its implementations.

Co-Authored-By: Claude <noreply@anthropic.com>
@andreiborza andreiborza force-pushed the ab/sentry-tracer-provider branch from cf369b6 to 749e7e7 Compare June 6, 2026 22:56
Comment thread packages/node/src/sdk/initOtel.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2f23900. Configure here.

const span = new SentryNonRecordingSpan({
traceId: propagationContext.traceId,
parentSpanId: propagationContext.parentSpanId,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignored parent span id

Medium Severity

When tracing is disabled, createChildOrRootSpan builds a SentryNonRecordingSpan with parentSpanId, but the non-recording span constructor never stores that field. Child placeholder spans lose their parent link in span context and JSON, so propagation and hierarchy can be wrong under tracing-without-performance.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2f23900. Configure here.

@andreiborza andreiborza force-pushed the ab/sentry-tracer-provider branch 2 times, most recently from a0be013 to 2f2c2c6 Compare June 7, 2026 13:23
@andreiborza andreiborza force-pushed the ab/sentry-tracer-provider branch from 2f2c2c6 to fe36106 Compare June 7, 2026 14:26
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