snowplow / snowplow-android-tracker

Snowplow event tracker for Android. Add analytics to your Android apps and games
http://snowplowanalytics.com
Apache License 2.0
107 stars 63 forks source link

Add configurable limit for the maximum age and number of events in the event store and remove old events before sending (close #660) #661

Closed matus-tomlein closed 5 months ago

matus-tomlein commented 5 months ago

Issue #660

The event store is currently unbounded meaning that if events fail to be sent to the collector, they are never removed from the event store. This can lead to it growing endlessly (if for instance an ad blocker blocks the collector domain) which is likely to have an impact on the app.

We should add configurable limits to the event store so that old events are removed. We could have two such limits:

The implementation in this PR adds these limits and enforces them before each emit attempt. They are enforced by running a single SQL statement which should be relatively efficient.

In addition, this PR removes some unnecessary optional types in the event store interface.