RUM-10314: Read feature context only when explicitly requested by the caller#2716
Merged
Conversation
Base automatically changed from
nogorodnikov/rum-386/process-feature-context-on-context-thread
to
nogorodnikov/rum-8170/feature-context-sync
June 11, 2025 09:29
0xnm
force-pushed
the
nogorodnikov/rum-10314/read-feature-context-only-when-requested
branch
from
June 11, 2025 10:19
ee09fa5 to
8c53e5f
Compare
mariusc83
approved these changes
Jun 11, 2025
aleksandr-gringauz
approved these changes
Jun 12, 2025
ambushwork
reviewed
Jun 12, 2025
0xnm
force-pushed
the
nogorodnikov/rum-10314/read-feature-context-only-when-requested
branch
from
June 12, 2025 08:48
8c53e5f to
4b15242
Compare
ambushwork
approved these changes
Jun 12, 2025
0xnm
merged commit Jun 12, 2025
59b6870
into
nogorodnikov/rum-8170/feature-context-sync
24 checks passed
0xnm
deleted the
nogorodnikov/rum-10314/read-feature-context-only-when-requested
branch
June 12, 2025 09:51
2 tasks
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?
We now have a possibility to update feature context from multiple threads, which imposes the need to use write/read locks.
This means that if
withWithContext,withContext, etc. methods are made which provideDatadogContextin the callback, if there is any feature context update is ongoing, we need to wait for its completion (since write lock is acquired, making it impossible to read until unlocked) to put the right value.However, caller may not need the particular feature context, so this wait may be for nothing.
This PR adds an additional argument
withFeatureContextto the methods mentioned above which is used to explicitly indicate what feature contexts caller is interested in. This makes API a bit more verbose, but at the same time we avoid the possible redundant wait time.That change won't be needed if all feature updates/reads would happen on the context processing thread, but it is not the case.
Review checklist (to be filled by reviewers)