Shadow: ♻️ Replace BoundedBuffer with BufferedObservable and track dropped data via telemetry (v1)#85
Open
allspain wants to merge 3 commits into
Open
Shadow: ♻️ Replace BoundedBuffer with BufferedObservable and track dropped data via telemetry (v1)#85allspain wants to merge 3 commits into
allspain wants to merge 3 commits into
Conversation
Add drop counting to BufferedObservable with an optional onDrop callback invoked on unbuffer(). Wire it up in startBufferingData to send a telemetry debug event when buffered data is lost.
…ll buffering - Remove deprecated BoundedBuffer module and its tests - Migrate preStartLogs and preStartRum to use BufferedObservable with drop telemetry - Use shared bufferContextCalls from core instead of local copy in rum-core - Fix test assertions to await specific spies instead of startRumSpy for accuracy
- Move shared variables and setup from beforeEach into the only test that uses them, removing unnecessary shared state
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.
Shadow Review — PR
#4489v1Source:
DataDog/browser-sdk#4489Commit:
ee5a123f689e75a6d6bb78c43054f6384f153f60Timestamp: 2026-04-15T12:26:11Z
Original PR Description
Motivation
When API calls are made before the SDK starts, they are buffered and replayed once initialization completes. Previously this used
BoundedBuffer, which silently dropped data when the buffer limit was reached. This change migrates toBufferedObservableand adds telemetry reporting when buffered data is lost, giving us visibility into potential data loss.Changes
BufferedObservablewith an optionalonDropcallback invoked onunbuffer()startBufferingDatato send a telemetry debug event when buffered data is droppedBoundedBufferwithBufferedObservableinpreStartLogsandpreStartRumBoundedBuffermodule and its testsTest instructions
yarn test:unit --spec packages/core/src/tools/observable.spec.tsyarn test:unit --spec packages/rum-core/src/boot/rumPublicApi.spec.tsyarn test:unit --spec packages/core/src/domain/bufferedData.tsChecklist