-
Notifications
You must be signed in to change notification settings - Fork 131
Metrics Manager configurable synchronize interval #228
Comments
Hey Josep, Thanks for getting in touch, I hope it's okay if we use just one issue instead of 3 all over the place ;) First, let's talk about why there is no API for it. We have been burned by exposing an API in the past with another SDK where people would set crazy values and then blame the SDK on eating up their battery and we don't have any plans to expose an API for this for this exact reason. Best, |
Hi Benny, If we have a testing mode where we get the batches more frequently, I would personally not mind extend the batch interval to several minutes, since I am not fuzzed that much about liveliness of this data. Furthermore, and based on the Optimizing Downloads for Efficient Network Access docs, 15 seconds means that the network will be constantly switching between low and high battery usage, which means the app will have a high impact on battery. Quoting Google:
However, I feel like this wouldn't properly fit all use cases, so what if the SDKs offer an enum to configure how frequently it flushes the events? How about:
This would allow consumers of the API to decide if they want immediate upload during testing, or to look for their sweet spot. On Manually triggeredIf a consumer of your SDK wants to make the calls as efficient as possible, an API that allows to flush the analytics batches on demand would allow to perform optimisations such as: Batch transfers and connections, by firing the analytics events when another network call occurs. In Minimizing the Effect of Regular Updates, Google recommends to use Network Scheduling Tools. The consumer could be using the AlarmManager, SyncAdapter, or JobScheduler APIs (or any other sort of scheduling API) to manually trigger a batch sync at the time it is more convenient to them. In Modifying your Download Patterns Based on the Connectivity Type the recommendation is to take advantage of Wi-Fi connections. |
Hey Josep, We've discussed both options in the past and I definitely see the value. We'll discuss internally next week and and I'll let you know the outcome over here. Thanks for all the input from your side. This is very important for us. Keep it coming! Have a great weekend! |
Hey Josep, I just merged a PR that adds support for "debug" intervals to Thanks again for your input! It's invaluable! |
Cheers Ben! |
I'm closing this as we've added the debug intervals. That said, the API to customize the sending interval is still on our backlog. |
I have noticed that the current setup for the Metrics Manager uses hardcoded values for maximum batch count and batch interval between batch synchronizations:
Having a hardcoded interval means that:
In my opinion, the default behaviour of the SDK should be aligned with the "Optimizing Downloads for Efficient Network Access" article on developer.android.com.
Furthermore, those two properties should be configurable so as to allow the users to tweak it if their use case has different needs (e.g. increase while testing).
The text was updated successfully, but these errors were encountered: