Skip to content

Fix/telemetry overlapping flushes#411

Merged
Mosas2000 merged 10 commits into
mainfrom
fix/telemetry-overlapping-flushes
May 20, 2026
Merged

Fix/telemetry overlapping flushes#411
Mosas2000 merged 10 commits into
mainfrom
fix/telemetry-overlapping-flushes

Conversation

@Mosas2000

Copy link
Copy Markdown
Owner

Implementation Details:
Serialized Flush Operations: Chained concurrent calls to flush() onto the activeFlushPromise sequence using a clean promise-chain wrapper, guaranteeing that only one send operation remains in flight at any given time.
Preserved Queue Integrity: Spliced batches are correctly prepended back to eventQueue if the send operation completely fails after all retry attempts (and the sink remains enabled), preventing duplicate or lost events.
Reset Handling: Added safety guarantees that automatically discard failed batches and prevent event prepending if resetSink() is invoked during active flushes.
Unit Tests: Added three comprehensive concurrent flush test cases to cover:
Overlapping flush serialization.
Queue integrity and event ordering preservation when flushes fail.
Sink reset/disable behaviors during failed concurrent flushes.

Closes #338

@Mosas2000 Mosas2000 merged commit d8a0926 into main May 20, 2026
4 of 9 checks passed
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.

Telemetry sink should prevent overlapping batch flushes

1 participant