Skip to content
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

RUMM-2713: Move global RUM context into generic feature context storage #1146

Merged

Conversation

0xnm
Copy link
Member

@0xnm 0xnm commented Nov 16, 2022

What does this PR do?

This change removes global RUM context from GlobalRum singleton by moving it to the feature's context (DatadogContext#featuresContext).

Now RUM context will be stored in the generic dictionary Map<String, Any?> and can be accessed either by calling DatadogContext#featuresContext or by calling SdkCore#getFeatureContext.

Also SdkCore#setFeatureContext is removed in the favour of SdkCore#updateFeatureContext method which gives a mutable dictionary for the update, final update is thread-safe.

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 November 16, 2022 12:53
@0xnm 0xnm force-pushed the nogorodnikov/rumm-2713/move-away-from-global-rum-context branch from 7cb8e6a to 35ccaee Compare November 16, 2022 13:15
@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2022

Codecov Report

Merging #1146 (ad1cf8a) into feature/sdkv2 (c484bd6) will increase coverage by 0.07%.
The diff coverage is 90.14%.

@@                Coverage Diff                @@
##           feature/sdkv2    #1146      +/-   ##
=================================================
+ Coverage          82.43%   82.50%   +0.07%     
=================================================
  Files                350      350              
  Lines              11524    11559      +35     
  Branches            1957     1980      +23     
=================================================
+ Hits                9499     9536      +37     
+ Misses              1424     1419       -5     
- Partials             601      604       +3     
Impacted Files Coverage Δ
...c/main/kotlin/com/datadog/android/rum/GlobalRum.kt 42.11% <0.00%> (-21.72%) ⬇️
...android/v2/core/internal/DatadogContextProvider.kt 81.54% <0.00%> (-2.04%) ⬇️
...og/android/v2/core/internal/NoOpContextProvider.kt 3.45% <0.00%> (-0.12%) ⬇️
...otlin/com/datadog/android/tracing/AndroidTracer.kt 94.03% <71.43%> (-2.89%) ⬇️
...iew/internal/rum/WebViewRumEventContextProvider.kt 87.50% <75.00%> (-12.50%) ⬇️
.../kotlin/com/datadog/android/v2/core/DatadogCore.kt 89.50% <83.33%> (+0.10%) ⬆️
.../android/rum/internal/domain/scope/RumViewScope.kt 96.56% <90.32%> (+0.01%) ⬆️
...android/log/internal/domain/DatadogLogGenerator.kt 97.32% <100.00%> (+0.93%) ⬆️
...lin/com/datadog/android/rum/internal/RumFeature.kt 93.14% <100.00%> (+0.14%) ⬆️
.../datadog/android/rum/internal/domain/RumContext.kt 97.37% <100.00%> (+7.37%) ⬆️
... and 19 more

@xgouchet xgouchet added the size-large This PR is large sized label Nov 16, 2022
@0xnm 0xnm force-pushed the nogorodnikov/rumm-2713/move-away-from-global-rum-context branch from 2d356b3 to ad1cf8a Compare November 17, 2022 08:19
it.setFeatureContext(featureName, mutableContext)
mutableContext
}
if (featureName == RumFeature.RUM_FEATURE_NAME) {
Copy link
Member

Choose a reason for hiding this comment

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

why are we doing this only for the RUM feature name ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because context which is received by DatadogPlugin contains only RUM-related info, so it makes sense to update it only when RUM context is updated.

Anyway, DatadogPlugin will be removed in v2. This code won't live long.

Copy link
Member

@mariusc83 mariusc83 left a comment

Choose a reason for hiding this comment

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

LGTM

@0xnm 0xnm merged commit 07c6fe9 into feature/sdkv2 Nov 17, 2022
@0xnm 0xnm deleted the nogorodnikov/rumm-2713/move-away-from-global-rum-context branch November 17, 2022 09:42
@xgouchet xgouchet added this to the 1.16.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size-large This PR is large sized
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants