Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Jan 25, 2024

Conversation

matus-tomlein
Copy link
Contributor

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:

  • maximum event store size – in case the number of events surpasses this threshold, oldest events will be removed until we are under the threshold. Default could be 1000.
  • maximum event age – in case there are events older than this threshold, we should remove them. Default could be 30 days.

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.

@matus-tomlein matus-tomlein requested review from mscwilson and a team January 19, 2024 10:31
Base automatically changed from issue/emitter_updates to release/6.0.0 January 25, 2024 14:23
Copy link
Contributor

@mscwilson mscwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@matus-tomlein matus-tomlein merged commit e56da18 into release/6.0.0 Jan 25, 2024
0 of 3 checks passed
matus-tomlein added a commit that referenced this pull request Jan 25, 2024
@matus-tomlein matus-tomlein deleted the issue/event_store_limits branch January 25, 2024 15:46
@mscwilson mscwilson mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants