Repository navigation
fix(otel): treat sentry-trace without a sampling flag as sampled in SentryPropagator - #5907
Conversation
SentryPropagator.Extract mapped a sentry-trace header without a sampling flag to ActivityTraceFlags.None, so OpenTelemetry's ParentBasedSampler dropped every span for requests from upstream services that had not made a sampling decision. Only an explicit -0 is now unsampled, matching sentry-java's OpenTelemetryOtlpPropagator. Fixes #5903 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## version7 #5907 +/- ##
=========================================
Coverage 76.98% 76.98%
=========================================
Files 538 538
Lines 19714 19714
Branches 3872 3872
=========================================
+ Hits 15176 15177 +1
- Misses 3666 3667 +1
+ Partials 872 870 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…From_Carrier Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
There's one case this PR doesn't cover, and I think it's fine to follow up on it separately. A service with ASP.NET Core starts the request activity from |
|
Thanks, confirmed. Tracking it separately in #5910, with a few options for fixing it. 🤖 Addressed by Claude Code |
Summary
SentryPropagator.Extractmapped asentry-traceheader with no sampling flag (<trace>-<span>, the deferred form) toActivityTraceFlags.None. OpenTelemetry's defaultParentBasedSamplersends a remote parent withoutRecordedtoAlwaysOff, so a service using the propagator dropped all spans for requests from upstream SDKs that hadn't made a sampling decision, and propagated-0further downstream.Now only an explicit
-0maps to unsampled; a missing flag becomesRecorded. This is option 1 from the issue and matches sentry-java'sOpenTelemetryOtlpPropagator.Notes for review
ParentBasedSampler, deferred requests are now always recorded, so a ratio-based root sampler is not consulted for them. Option 2 (marking the deferred case and shipping a sampler that delegates to the root sampler) would respect it but adds public API; it can follow separately if we want it.SentryPropagator.csis also compiled into the obsoleteSentry.OpenTelemetrypackage, whereAddSentry()registers it. There,SentrySpanProcessorpasses a remote parent'sRecordedflag toHub.StartTransactionas the sampling decision, which takes precedence overTracesSampleRate(aTracesSamplerstill runs first). Deferred requests used to be dropped even atTracesSampleRate = 1.0; they now become transactions even at0. sentry-java's span-processor mode runs its own sampler for a deferred parent instead.Fixes #5903
🤖 Generated with Claude Code