opentelemetry-android icon indicating copy to clipboard operation
opentelemetry-android copied to clipboard

Add ability to throttle exports when reading from disk.

Open breedx-splk opened this issue 1 year ago • 5 comments

If the user is offline or in airplane mode for a long time and a lot of data has buffered on disk, it is possible for the agent to use a lot of bandwidth. There is currently nothing that limits how much or how fast the data should be sent. Instead, we just try and export all the data on disk as fast as we can...and this can be a problem because it hogs a limited resource.

This feature could be opt-in or opt-out, but there should be a way to configure the max "bandwidth" used by the SignalFromDisk exporters. I used the quotes around "bandwidth" because I'm not sure that it needs to be strict bytes/time style, and we might just be able to do batch/time or spans/time or something similar.

This would ideally allow the data to flow more smoothly/consistently instead of "all at once".

breedx-splk avatar Oct 17 '24 22:10 breedx-splk

There is some prior art here in the Splunk ThrottlingExporter, but this is not exactly what we want because it favors dropping data instead of allowing it to stay buffered (on disk).

breedx-splk avatar Oct 17 '24 22:10 breedx-splk

@breedx-splk Can i be allowed to help with this one? thanks

Victorsesan avatar Oct 21 '24 02:10 Victorsesan

Sure, thanks!

breedx-splk avatar Oct 21 '24 21:10 breedx-splk

@breedx-splk Please help me out, can we create a new class/file in the android/export directory in this repo with a name like RateLimitedExporter.java to implement a SpanExporter interface which can help with this? or in which file can we implement the bandwidth-limiting feature in?. Thanks for the help

Victorsesan avatar Oct 23 '24 02:10 Victorsesan

@Victorsesan Yes, you would likely want to create a new package and new class(es) to implement this new functionality. Please review CONTRIBUTING.md and make sure include tests and to format with ./gradlew spotlessApply.

breedx-splk avatar Oct 23 '24 16:10 breedx-splk