Skip to content

Provide frozen snapshot of features context when requested#1213

Merged
0xnm merged 1 commit into
feature/sdkv2from
nogorodnikov/make-features-context-snapshot-at-the-datadog-context-creation-time
Jan 4, 2023
Merged

Provide frozen snapshot of features context when requested#1213
0xnm merged 1 commit into
feature/sdkv2from
nogorodnikov/make-features-context-snapshot-at-the-datadog-context-creation-time

Conversation

@0xnm

@0xnm 0xnm commented Jan 3, 2023

Copy link
Copy Markdown
Member

What does this PR do?

This change fixes a possible concurrency issue, when feature context can be modified by another thread while it is read by the caller. To solve this we are going to make a snapshot for the top 2 levels (features and feature-specific keys), this should be enough to get completely immutable map for cases of storage for our features (they are storing only strings, which are immutable, and no deeper than 2 levels).

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested a review from a team as a code owner January 3, 2023 16:10

@xgouchet xgouchet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@codecov-commenter

codecov-commenter commented Jan 4, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1213 (fcf0c04) into feature/sdkv2 (9bd0b15) will increase coverage by 0.07%.
The diff coverage is 80.00%.

@@                Coverage Diff                @@
##           feature/sdkv2    #1213      +/-   ##
=================================================
+ Coverage          82.65%   82.72%   +0.07%     
=================================================
  Files                353      353              
  Lines              12568    12571       +3     
  Branches            2084     2084              
=================================================
+ Hits               10388    10399      +11     
  Misses              1536     1536              
+ Partials             644      636       -8     
Impacted Files Coverage Δ
...android/v2/core/internal/DatadogContextProvider.kt 97.56% <80.00%> (+0.19%) ⬆️
...n/com/datadog/android/v2/core/SdkInternalLogger.kt 91.67% <0.00%> (-5.56%) ⬇️
...ain/java/com/datadog/opentracing/PendingTrace.java 57.76% <0.00%> (-0.86%) ⬇️
...src/main/kotlin/com/datadog/android/DatadogSite.kt 86.67% <0.00%> (ø)
...id/rum/internal/ndk/DatadogNdkCrashEventHandler.kt 91.00% <0.00%> (ø)
.../android/rum/internal/domain/scope/RumViewScope.kt 95.36% <0.00%> (+0.18%) ⬆️
...lin/com/datadog/android/rum/internal/RumFeature.kt 93.48% <0.00%> (+1.45%) ⬆️
...in/com/datadog/android/log/internal/LogsFeature.kt 86.92% <0.00%> (+1.54%) ⬆️
...rsistence/file/batch/PlainBatchFileReaderWriter.kt 83.08% <0.00%> (+1.54%) ⬆️
...ndroid/telemetry/internal/TelemetryEventHandler.kt 74.40% <0.00%> (+1.60%) ⬆️
... and 1 more

Base automatically changed from nogorodnikov/rumm-2828/send-logs-for-span-using-message-bus to feature/sdkv2 January 4, 2023 10:47
@0xnm
0xnm merged commit 62fa834 into feature/sdkv2 Jan 4, 2023
@0xnm
0xnm deleted the nogorodnikov/make-features-context-snapshot-at-the-datadog-context-creation-time branch January 4, 2023 12:21
@xgouchet xgouchet added this to the 1.17.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants