Skip to content

feat(plugin-session-replay-browser): add flushIntervalConfig passthrough#1769

Open
lewgordon-amplitude wants to merge 1 commit into
mainfrom
sr-plugin-flush-interval-config
Open

feat(plugin-session-replay-browser): add flushIntervalConfig passthrough#1769
lewgordon-amplitude wants to merge 1 commit into
mainfrom
sr-plugin-flush-interval-config

Conversation

@lewgordon-amplitude
Copy link
Copy Markdown
Collaborator

@lewgordon-amplitude lewgordon-amplitude commented May 22, 2026

Summary

  • The standalone @amplitude/session-replay-browser SDK shipped flushIntervalConfig in feat(session-replay-browser): add flushIntervalConfig to tune rrweb event-split cadence #1744 (commit c242dc3) with minIntervalMs / maxIntervalMs knobs that control rrweb event-split cadence.
  • The plugin (@amplitude/plugin-session-replay-browser) did not surface this option — its SessionReplayOptions type had no flushIntervalConfig field, and the value was never forwarded to sessionReplay.init().
  • This PR is a straight passthrough: adds the field to the plugin's SessionReplayOptions using the same @see pattern as the other forwarded options (privacyConfig, performanceConfig, crossOriginIframes, etc.), and includes it in the srInitOptions object passed to init().

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/javascript monorepo consumes the plugin, not the standalone SDK. It currently can't tune rrweb send cadence (e.g. to reduce 200 + X-Session-Replay-Event-Skipped throttling responses on session start) without this passthrough.

Changes

  • packages/plugin-session-replay-browser/src/typings/session-replay.ts — adds flushIntervalConfig?: NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']> to SessionReplayOptions
  • packages/plugin-session-replay-browser/src/session-replay.ts — adds flushIntervalConfig: this.options.flushIntervalConfig to the srInitOptions assignment
  • packages/plugin-session-replay-browser/test/session-replay.test.ts — adds two tests: passthrough of undefined when not set, and forwarding of an explicit { minIntervalMs, maxIntervalMs } value

Test plan

  • pnpm --filter @amplitude/plugin-session-replay-browser run test passes (52 tests, 100% coverage on the two non-integration suites)
  • Integration test suite failure (browser-sdk-integration.test.ts) is pre-existing on main (missing @amplitude/analytics-browser build artifact) and unrelated to this change
  • No new TypeScript errors — flushIntervalConfig exists on SessionReplayOptions via Omit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'> in the standalone SDK

Note

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-browser by exposing flushIntervalConfig on SessionReplayOptions and forwarding it into the srInitOptions passed to sessionReplay.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.

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>
@lewgordon-amplitude lewgordon-amplitude requested a review from a team as a code owner May 22, 2026 00:25
@github-actions
Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 58.31 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 131.96 KB (0%)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 208.94 KB (+0.01% 🔺)

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.

1 participant