dd-sdk-ios icon indicating copy to clipboard operation
dd-sdk-ios copied to clipboard

RUM-3175 fix: force events flushing by performing consent change on context queue

Open ganeshnj opened this issue 1 year ago • 1 comments

What and why?

Some events are missed which are recorded before the consent. but still in-memory. Migration happens before these events are written and we skip them. A typical race condition scenario.

How?

We force the sync here by switching the consent change to context queue. Because context is only read in its own queue and file writer requires context. This implicitly forces everything needs to be performed on the same queue sequentially.

Review checklist

  • [x] Feature or bugfix MUST have appropriate tests (unit, integration)
  • [x] Make sure each commit and the PR mention the Issue number or JIRA reference
  • [ ] Add CHANGELOG entry for user facing changes

ganeshnj avatar Sep 25 '24 08:09 ganeshnj

Datadog Report

Branch report: ganeshnj/fix/consent-migration Commit report: 817a0e1 Test service: dd-sdk-ios

:white_check_mark: 0 Failed, 3473 Passed, 0 Skipped, 3m 35.42s Total Time :small_red_triangle_down: Test Sessions change in coverage: 2 decreased, 5 increased, 7 no change

:small_red_triangle_down: Code Coverage Decreases vs Default Branch (2)

  • test DatadogInternalTests tvOS 79.51% (-0.04%) - Details
  • test DatadogRUMTests iOS 81.09% (-0.02%) - Details

(...) to call the migration from the context queue, also after publishing the new consent.

@maxep Fair call ✅. I continued this work fixing it in proposed way ☝️. It's not necessary to publish the consent before migration task as migration depends on the new consent value explicitly.

ncreated avatar Nov 06 '24 13:11 ncreated

/merge

ncreated avatar Nov 06 '24 13:11 ncreated

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in develop is 29m.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Nov 06 '24 13:11 dd-devflow[bot]

:rotating_light: MergeQueue: This merge request is in error

mergequeue build completed successfully, but the github api returned an error while merging the pr. It's probably because:

  • repository configuration requires approval by code owners, but no code owner approved this PR
  • target branch of PR is restricted to only allow up-to-date branches, but the pr is now outdated
Details

Error: PUT https://api.github.com/repos/DataDog/dd-sdk-ios/pulls/2063/merge: 405 Required status check "dd-gitlab/Sync GH Checks" is expected. []

FullStacktrace: activity error (type: github.GithubService_MergePullRequest, scheduledEventID: 41, startedEventID: 42, identity: 1@github-worker-78dd5544fc-6gzkw@): PUT https://api.github.com/repos/DataDog/dd-sdk-ios/pulls/2063/merge: 405 Required status check "dd-gitlab/Sync GH Checks" is expected. [] (type: GitFailure, retryable: false): PUT https://api.github.com/repos/DataDog/dd-sdk-ios/pulls/2063/merge: 405 Required status check "dd-gitlab/Sync GH Checks" is expected. [] (type: ErrorResponse, retryable: true)

If you need support, contact us on Slack #devflow with those details!

dd-devflow[bot] avatar Nov 06 '24 14:11 dd-devflow[bot]

/merge

ncreated avatar Nov 06 '24 14:11 ncreated

:steam_locomotive: MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Nov 06 '24 14:11 dd-devflow[bot]

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in develop is 29m.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Nov 06 '24 14:11 dd-devflow[bot]