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-824 Add API for customizing batch size and upload frequency #358

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Jan 5, 2021

What and why?

📦 This PR adds two new public APIs, so that the user can customize the size and frequency of requests made by the SDK.

How?

The write / upload settings were already abstracted by PerformancePreset type, so this PR just configures its values depending on the BatchSize and UploadFrequency received from the user with two new public APIs:

public func set(batchSize: BatchSize)
public func set(uploadFrequency: UploadFrequency)

Because the iOS SDK provides different presets for iOS apps and iOS app extensions, the values computed for PerformancePreset are additionally customized to work well in short-lived app extension environment.

The PerformancePreset computed for iOS app is unified with the values introduced for Android SDK DataDog/dd-sdk-android#454 and DataDog/dd-sdk-android#453.

The new APIs are also exposed for Objc SDK.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@ncreated ncreated requested a review from a team as a code owner January 5, 2021 11:14
@ncreated ncreated self-assigned this Jan 5, 2021
) {
let meanFileAgeInSeconds: TimeInterval = {
switch (bundleType, batchSize) {
case (.iOSApp, .small): return 5
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, what's the difference between iOSApp and iOSAppExtension ?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is due to GH issue number 52
(i'm not giving the actual refererence to it on purpose, no need to alert it i guess)

Copy link
Member Author

Choose a reason for hiding this comment

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

iOS App Extensions are the way to add functionality beyond the app so they can interact with other apps or the system (e.g. home screen widgets).

We differentiate PerformancePreset in app extension, because its process is usually designed to work only for the very short amount of time, when the user interacts with it, e.g. chooses the Slack channel and message to upload photo directly from the iOS photo library through Slack Extension (w/o launching the Slack app).

Such PerformancePreset for app extension stores and uploads data much mor frequently + its initial upload is scheduled almost right away when the app extension starts. This is to make sure the SDK has enough chance to upload all data before the extension is closed (which usually happens in few seconds after it was started).

@ncreated ncreated merged commit 53109cf into master Jan 7, 2021
@ncreated ncreated deleted the ncreated/RUMM-824-RUMM-823-add-api-for-custom-upload-frequency-and-batch-size branch January 7, 2021 08:04
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.

3 participants