-
-
Notifications
You must be signed in to change notification settings - Fork 220
feat: Associate replays with errors and traces on Android #4133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jamescrosswell
wants to merge
17
commits into
main
Choose a base branch
from
replay-link-events
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+423
−26
Conversation
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
Part of #2136 Associate Errors and Traces with the active Session Replay (if one exists) on Android.
|
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.
Part of #2136
Associate Errors and Traces with the active Session Replay (if one exists) on Android.
Protocol
Although there is a new Replay context, I found that just setting the replay_id on that context (e.g. for an event) did not result in the event showing in the errors pane for session replays.
What was recommended, and work better, is to store the
replay_id
on the DSC (which will accompany all events) and let Relay unpack it from there. The DSC specification mentionsreplay_id
as an optional property on the dynamic sampling context.Getting the Replay ID
There are three ways the DSC can be created:
From the Transaction
When starting a new transaction, we check first to see if there's a replay_id on the DSC (in distributed transactions - probably won't hit this in a MAUI app). If it's present, we use that. Otherwise we try to get the replay_id from the Java SDK:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 137 to 139 in efb200d
This then gets stored in the DSC when creating the DSC for the transaction (if it doesn't already exist):
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 183 to 186 in b8d9452
From the propagation context
When continuing a trace in a distributed transaction when performance is disabled, a propagation context is created from the baggage headers and then stored on the scope:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 261 to 262 in 0989eca
If there is no DSC (no baggage headers) then a new DSC is created for the PropagationContext:
sentry-dotnet/src/Sentry/SentryPropagationContext.cs
Lines 13 to 22 in c2a31b4
In that case, we populate the replay_id from the Java SDK:
sentry-dotnet/src/Sentry/DynamicSamplingContext.cs
Line 190 in b8d9452
On the other hand, if there are baggage headers and the PropagationContext does have a DSC, the ContinueTrace method returns a TransactionContext after storing the PropagationContext on the scope:
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 264 to 271 in 0989eca
This gets used when creating a new TransactionTracer.
sentry-dotnet/src/Sentry/TransactionTracer.cs
Lines 255 to 256 in 6d770cb