feat(replay): Add beforeStoreFrame callback for snapshot testing#5386
Open
runningcode wants to merge 3 commits intomainfrom
Open
feat(replay): Add beforeStoreFrame callback for snapshot testing#5386runningcode wants to merge 3 commits intomainfrom
runningcode wants to merge 3 commits intomainfrom
Conversation
Add an experimental callback that fires right before a replay frame is
stored to disk. The callback receives the masked bitmap (via Hint),
timestamp, and current screen name. This enables snapshot testing of
replay masking without needing to decode stored video segments.
Includes a Kotlin extension for ergonomic usage:
options.sessionReplay.beforeStoreFrame { bitmap, ts, screen -> ... }
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Add beforeStoreFrame callback for snapshot testing ([#5386](https://github.com/getsentry/sentry-java/pull/5386))If none of the above apply, you can opt out of this check by adding |
📲 Install BuildsAndroid
|
5b10cdd to
e7452f7
Compare
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5865051 | 319.74 ms | 365.60 ms | 45.86 ms |
| 0220a5c | 452.20 ms | 479.33 ms | 27.12 ms |
| 2124a46 | 319.19 ms | 415.04 ms | 95.85 ms |
| 2195398 | 322.52 ms | 361.91 ms | 39.39 ms |
| bbc35bb | 298.53 ms | 372.17 ms | 73.64 ms |
| d364ace | 382.77 ms | 443.21 ms | 60.44 ms |
| d15471f | 379.40 ms | 470.76 ms | 91.36 ms |
| 9139b91 | 351.35 ms | 355.63 ms | 4.28 ms |
| fc5ccaf | 322.49 ms | 405.25 ms | 82.76 ms |
| 52feca7 | 314.77 ms | 378.67 ms | 63.90 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5865051 | 0 B | 0 B | 0 B |
| 0220a5c | 0 B | 0 B | 0 B |
| 2124a46 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
| 2195398 | 0 B | 0 B | 0 B |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| d364ace | 1.58 MiB | 2.11 MiB | 539.75 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 9139b91 | 1.58 MiB | 2.13 MiB | 559.52 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| 52feca7 | 0 B | 0 B | 0 B |
…(JAVA-504) Add ReplaySnapshotTest that uses the beforeStoreFrame callback to capture masked replay frames during a Compose UI test. Frames are written to the Downloads/sauce_labs_custom_screenshots/ directory, which is the standard path Sauce Labs collects screenshots from. CI changes: - Add *.png to Sauce Labs artifact match patterns - Upload collected replay snapshots via sentry-cli build snapshots Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e7452f7 to
2aff4b0
Compare
…VA-504) The Kotlin extension `beforeStoreFrame` comes from `sentry-android-replay` which may not resolve in the UI test module. Use the Java callback API directly instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
BeforeStoreFrameCallbacktoSentryReplayOptionsthat fires right before a replay frame is stored to disk, receiving the masked bitmap, timestamp, and screen name viaHintSentryReplayOptions.beforeStoreFrame { bitmap, ts, screen -> }for ergonomic usageReplaySnapshotTestUI integration test that captures masked replay frames viaTestStorageon Sauce LabsuseTestStorageServiceand*.pngartifact collection in the Sauce Labs config, withsentry-cli build snapshotsupload in CIRelates to JAVA-504
🤖 Generated with Claude Code