Repository navigation
fix: transactions continue the external propagation context's trace - #5825
Draft
bitsandfoxes wants to merge 1 commit into
Draft
bitsandfoxes wants to merge 1 commit into
bitsandfoxes wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5825 +/- ##
=======================================
Coverage 76.13% 76.13%
=======================================
Files 528 528
Lines 19579 19592 +13
Branches 3829 3834 +5
=======================================
+ Hits 14906 14916 +10
- Misses 3791 3792 +1
- Partials 882 884 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Would an alternative (to this PR) be that Unity calls And calling |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExternalPropagationContexthas only been used withUseOtlp, which also setsDisableSentryTracing. So the hub never had an external trace and Sentry transactions at the same time. sentry-unity now has both: with Unity as a Library (getsentry/sentry-unity#2885), the game continues the trace of the native app's SDK (sentry-cocoa, sentry-java). Its events, logs and outgoing requests already join that trace through the external context. Its transactions don't:StartTransactionalways starts a new trace. sentry-unity works around this in its ownSentrySdk.StartTransaction. This draft proposes doing it in the hub instead. It's meant as a starting point for discussion.StartTransactiontreats the external context as the ambient parent when the transaction context has no parent of its own. With a sampling decision, the transaction becomes a child of the external span and inherits its decision and DSC. Without one, it's a root in the external trace and samples itself.IExternalPropagationContext.IsSampledis nowbool?. A native trace without an active span has no decision, andfalsemade outgoing requests sendsentry-trace: …-0andsentry-sampled=false, so downstream services dropped their part.OtelPropagationContextreturnsnullonly without anActivity, where it has no trace ID either, so OTLP behaves as before.Open questions:
new TransactionContext(name, op)always gets a random trace ID, so "no parent" is the only signal, and a trace ID passed explicitly without a parent is replaced. That would need an explicit opt-out, or a record of whether the trace ID was generated.CaptureEvent_ExternalPropagationContext_PrefersExternalContext). With transactions in the external trace, an event inside one gets the right trace but the external span instead of the transaction's. sentry-unity hides the external trace while a sampled span of its own is active. Should an active Sentry span win when both exist? That's unchanged here because the order was deliberate for OTLP.#skip-changelog:
IExternalPropagationContextis internal and only sentry-unity uses it with Sentry tracing on.🤖 Generated with Claude Code