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-2204: Data is written in the SDK specific location #975

Conversation

0xnm
Copy link
Contributor

@0xnm 0xnm commented Jul 7, 2022

What does this PR do?

This change brings support of dedicated storage folders for multiple SDK instances. Now each SdkCore instance will get a unique ID, which is sha256(token+site), and this ID will be used to create a root folder where this particular instance is going to store features data. Now, the folder structure will be like the following:

 datadog-b0f6d4ccffaa
   rum-pending-v2
   logs-v3
   traces-v4
 datadog-a4b6c1d4eebb
   rum-v5
   logs-pending-v6
   traces-v7

In the example above we have 2 instances of SdkCore running with IDs b0f6d4ccffaa and a4b6c1d4eebb.

CoreFeature now owns storageDir which will be the root for all the storage of the particular SDK instance. By referencing it from the persistence layer it is possible to remove Context references from many places.

SDK is still going to store files in the cache folder, in that sense nothing changed.

This change also cherry-picks f1890e1 to remove unused endpoints (in order to avoid adding unnecessary code) and removes file location migration (from files dir to cache dir), because anyway new file format for batches is not compatible with old SDK.

Similar to DataDog/dd-sdk-ios#906.

NB: If SHA-256 doesn't exist on the device there is no fallback, we don't proceed with SDK initialization. I think this is fine, because "this should never happen" (c) (unlikely that some OEMs is going to strip out such basic things from the OS build).

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 July 7, 2022 12:42
@@ -9,7 +9,6 @@
package com.datadog.android.core.internal

import android.content.Context
import androidx.annotation.WorkerThread
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these 2 first commits are from another PR ? Maybe you need a rebase ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first commit is indeed from #973, I cherry-picked it explicitly, because it is on the develop branch.

Copy link
Collaborator

@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 2369852 into feature/sdkv2 Jul 11, 2022
@0xnm 0xnm deleted the nogorodnikov/rumm-2204/data-is-written-in-sdk-specific-location branch July 11, 2022 15:35
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants