Repository navigation
feat: Report dropped events through onEventsDropped and droppedEvents - #331
Open
tharunkumardeveloper wants to merge 2 commits into
Open
tharunkumardeveloper wants to merge 2 commits into
tharunkumardeveloper wants to merge 2 commits into
Conversation
…edEvents Part of Flagsmith#330: a programmatic signal when the event processor drops events without sending them.
tharunkumardeveloper
requested review from
khvn26
and removed request for
a team
November 26, 2026 17:14
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Re-trigger cubic
- A buffer-full drop is reported once the new event is in the buffer, and drops caused while onEventsDropped runs (by events it tracks itself) are counted in droppedEvents without calling it again: no recursion, and the buffer never exceeds maxBuffer. - Events tracked after the environment key was refused are reported as unauthorised and counted. - Tests: the 401 case buffers a second event while the request is pending; events tracked after the refusal; a callback that tracks events; the throwing callback's error is logged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #330.
What
Events the processor drops without sending were only logged. This adds a programmatic signal:
eventProcessorConfig.onEventsDropped({ count, reason }): called whenever events are dropped, withreasonone ofbuffer_full(the buffer was full while a batch was in flight or kept),failed(a batch failedwith a status that isn't retried) or
unauthorised(the environment key was refused).EventProcessor.droppedEvents: the running total.An error thrown by the callback is logged and never reaches
trackEvent.Why
An app that sends experiment events can't tell from code that some were lost, so its experiment results can be
biased without anyone noticing. With the callback it can count, alert, or slow down. In #330's reproduction
(300 events/s, the events API answering after 5 s, defaults) 25% of events were dropped and only logged.
Tests
Four new tests in
tests/sdk/events.test.ts: buffer-full drops reported and counted, a non-retried failure reportedas
failed, a 401 reported asunauthorisedwith every buffered event, and a throwing callback not breaking tracking.The existing event tests are unchanged and pass.
Not in this PR
The other half of #330: a buffer raised past ~7,000 events can produce a batch over the events API's 2 MiB limit,
which is then refused whole. Splitting batches by size would fix that; happy to follow up if that direction suits
you after #325's changes.