RUM-10040: Perform lazy capture of DatadogContext at the span creation#2662
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## nogorodnikov/rum-8170/feature-context-sync #2662 +/- ##
==============================================================================
- Coverage 70.09% 70.08% -0.01%
==============================================================================
Files 819 820 +1
Lines 30615 30630 +15
Branches 5111 5118 +7
==============================================================================
+ Hits 21458 21466 +8
- Misses 7742 7746 +4
- Partials 1415 1418 +3
🚀 New features to boost your workflow:
|
ambushwork
approved these changes
May 20, 2025
jonathanmos
approved these changes
May 21, 2025
aleksandr-gringauz
approved these changes
May 21, 2025
0xnm
deleted the
nogorodnikov/rum-10040/do-lazy-capture-of-rum-context-at-span-start
branch
May 21, 2025 10:03
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.
What does this PR do?
Right now when span is started and
bundleWithRum=truein OpenTracing or OpenTelemetry tracers configuration, we are doing a call to get RUM context in the synchronous way, thus blocking a caller thread.With the migration to the context processing thread, we cannot allow long blocking on the caller thread, so in this PR we do a lazy capture of the
DatadogContextat the span creation time and add a captor as a span tag.Later on it is safe to access value captured at the span write stage, because
withWriteContextwill also be executed on the context processing thread, meaning by that time the call we did before (withContext) to capture initial context will be completed.This PR aims to glue the blocking/sync API of tracing and async API of the event/context processing.
Review checklist (to be filled by reviewers)