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-2142: Allow global context update if view is stopped in a new session #913

Conversation

0xnm
Copy link
Member

@0xnm 0xnm commented Apr 26, 2022

What does this PR do?

This change should fix having a telemetry entry saying that current view ID doesn't match view ID in the global RUM context. This may happen if we update the context when new session started - this means we also change view ID for the current view.

This PR fixes that allowing update of the global context in case of the session ID mismatch.

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 April 26, 2022 15:39
)
false
when {
currentContext.sessionId != this.sessionId -> {
Copy link
Member

Choose a reason for hiding this comment

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

good catch

Copy link
Member

Choose a reason for hiding this comment

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

If the session id is different then it might mean that another view is active, which you could be erasing here. What's your logic for doing this check?

Copy link
Member Author

Choose a reason for hiding this comment

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

Normally it shouldn't be another view at this point, because the current one should be stopped first (if we are saying that stopView is called). If stopView is not called for current view and another view starts (via startView), then stopped flag will be true after onStartView with event having key of another view, so we won't even go in this logical branch.

Anyway, such override was a case even before, when GlobalRum.updateRumContext was called in onStopView without such verification, so at least we are not making things worse.

@0xnm 0xnm force-pushed the nogorodnikov/rumm-2142/allow-global-context-update-on-new-session branch from 0be455f to e04f942 Compare April 27, 2022 09:54
)
false
when {
currentContext.sessionId != this.sessionId -> {
Copy link
Member

Choose a reason for hiding this comment

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

If the session id is different then it might mean that another view is active, which you could be erasing here. What's your logic for doing this check?

@codecov-commenter
Copy link

codecov-commenter commented Apr 27, 2022

Codecov Report

Merging #913 (e04f942) into develop (be3cb96) will decrease coverage by 0.12%.
The diff coverage is 88.24%.

@@             Coverage Diff             @@
##           develop     #913      +/-   ##
===========================================
- Coverage    83.07%   82.95%   -0.12%     
===========================================
  Files          267      267              
  Lines         9047     9054       +7     
  Branches      1453     1455       +2     
===========================================
- Hits          7515     7510       -5     
- Misses        1137     1148      +11     
- Partials       395      396       +1     
Impacted Files Coverage Δ
.../android/rum/internal/domain/scope/RumViewScope.kt 96.55% <88.24%> (-0.44%) ⬇️
...ndroid/core/internal/persistence/file/EventMeta.kt 80.00% <0.00%> (-10.00%) ⬇️
...android/rum/internal/ndk/DatadogNdkCrashHandler.kt 83.91% <0.00%> (-4.60%) ⬇️
...rc/main/java/com/datadog/opentracing/DDTracer.java 55.65% <0.00%> (-0.42%) ⬇️
...tadog/android/core/internal/net/CurlInterceptor.kt 83.33% <0.00%> (+2.38%) ⬆️

@0xnm 0xnm merged commit 54498c8 into develop Apr 27, 2022
@0xnm 0xnm deleted the nogorodnikov/rumm-2142/allow-global-context-update-on-new-session branch April 27, 2022 13:32
@xgouchet xgouchet added this to the 1.13.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants