feat(plugin-session-replay-browser): add flushIntervalConfig passthrough#1769
Open
lewgordon-amplitude wants to merge 1 commit into
Open
feat(plugin-session-replay-browser): add flushIntervalConfig passthrough#1769lewgordon-amplitude wants to merge 1 commit into
lewgordon-amplitude wants to merge 1 commit into
Conversation
Surface the standalone SDK's flushIntervalConfig option in the plugin's SessionReplayOptions type and forward it to sessionReplay.init(), so consumers of the plugin can tune rrweb event-split cadence (minIntervalMs / maxIntervalMs) the same way the standalone SDK allows. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
size-limit report 📦
|
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.
Summary
@amplitude/session-replay-browserSDK shippedflushIntervalConfigin feat(session-replay-browser): add flushIntervalConfig to tune rrweb event-split cadence #1744 (commit c242dc3) withminIntervalMs/maxIntervalMsknobs that control rrweb event-split cadence.@amplitude/plugin-session-replay-browser) did not surface this option — itsSessionReplayOptionstype had noflushIntervalConfigfield, and the value was never forwarded tosessionReplay.init().SessionReplayOptionsusing the same@seepattern as the other forwarded options (privacyConfig,performanceConfig,crossOriginIframes, etc.), and includes it in thesrInitOptionsobject passed toinit().No behavior change for existing consumers — the option is optional and the standalone SDK already has its own defaults and clamping logic (
MIN_FLUSH_INTERVAL_FLOOR_MS,MAX_INTERVAL).Downstream motivation: the
amplitude/javascriptmonorepo consumes the plugin, not the standalone SDK. It currently can't tune rrweb send cadence (e.g. to reduce200 + X-Session-Replay-Event-Skippedthrottling responses on session start) without this passthrough.Changes
packages/plugin-session-replay-browser/src/typings/session-replay.ts— addsflushIntervalConfig?: NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>toSessionReplayOptionspackages/plugin-session-replay-browser/src/session-replay.ts— addsflushIntervalConfig: this.options.flushIntervalConfigto thesrInitOptionsassignmentpackages/plugin-session-replay-browser/test/session-replay.test.ts— adds two tests: passthrough ofundefinedwhen not set, and forwarding of an explicit{ minIntervalMs, maxIntervalMs }valueTest plan
pnpm --filter @amplitude/plugin-session-replay-browser run testpasses (52 tests, 100% coverage on the two non-integration suites)browser-sdk-integration.test.ts) is pre-existing onmain(missing@amplitude/analytics-browserbuild artifact) and unrelated to this changeflushIntervalConfigexists onSessionReplayOptionsviaOmit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'>in the standalone SDKNote
Low Risk
Low risk: this is an additive, optional configuration passthrough and only affects behavior when consumers explicitly set
flushIntervalConfig.Overview
Adds support for configuring rrweb flush cadence from
@amplitude/plugin-session-replay-browserby exposingflushIntervalConfigonSessionReplayOptionsand forwarding it into thesrInitOptionspassed tosessionReplay.init().Updates tests to assert the option is passed through both when omitted (
undefined) and when explicitly provided.Reviewed by Cursor Bugbot for commit b98a08e. Bugbot is set up for automated code reviews on this repo. Configure here.