Create configuration parameter for disk-buffering exporting frequency
Background
Currently the disk buffering exporter attempts to export every 10 seconds - the WorkDelegator has a loop of 10 second to check, if the PeriodicRunnable isReadyToRun():
https://github.com/open-telemetry/opentelemetry-android/blob/7238ac498aa2b74760f0a9958800fd8138fea23c/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWork.kt#L35
... and the DefaultExportScheduler uses the same 10 seconds waiting period to show its readiness:
https://github.com/open-telemetry/opentelemetry-android/blob/7238ac498aa2b74760f0a9958800fd8138fea23c/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt#L20
Problem
Since my internal enterprise apps are used by colleagues 8 hours a day it is critical to not put too much strain on their phone's batteries. The 10 second exporting frequency means that the phone has to do IO 2880 times during an 8 hour workday, if my Maths is correct, which feels like a lot both for the devices and for the backend to handle as well, if the number of devices is high.
Proposed solution
I would increase the default exporting frequency to 1 minute. Additionally, I would create a new config parameter in DiskBufferingConfig, which allows setting the exporting frequency catering for various preferences on the tradoff between real-time-ness and battery consumption.
Alternatively or additionally, the WorkManager API could be used (#882), which raises the minimum frequency to 1x in 15 minutes and optimizes the battery life even better.
@breedx-splk assign
@bencehornak assign me this
@namanONcode I can't do that sadly, bc I'm not a maintainer. @breedx-splk could you help with the assignment?
@fractalwrench @breedx-splk i have done implementing auto detector with all coverage test and also its default is 10 sec and there are multiple test cases with different real condition in testing time can be adjusted according 1 min two min etc . https://github.com/open-telemetry/opentelemetry-android/pull/1446