Create configuration parameter for disk-buffering exporting frequency #947
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Background
Currently the disk buffering exporter attempts to export every 10 seconds - the
WorkDelegator
has a loop of 10 second to check, if thePeriodicRunnable
isReadyToRun()
:opentelemetry-android/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWork.kt
Line 35 in 7238ac4
... and the
DefaultExportScheduler
uses the same 10 seconds waiting period to show its readiness:opentelemetry-android/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt
Line 20 in 7238ac4
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.The text was updated successfully, but these errors were encountered: