feat(replay): Record segment names (transaction names)#5763
Open
sentry-junior[bot] wants to merge 8 commits into
Open
feat(replay): Record segment names (transaction names)#5763sentry-junior[bot] wants to merge 8 commits into
sentry-junior[bot] wants to merge 8 commits into
Conversation
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
Contributor
|
📲 Install BuildsAndroid
|
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 403.90 ms | 546.09 ms | 142.19 ms |
| e63ad34 | 310.20 ms | 366.84 ms | 56.63 ms |
| 5865051 | 319.74 ms | 365.60 ms | 45.86 ms |
| a1eadfa | 345.67 ms | 411.26 ms | 65.59 ms |
| b193867 | 319.59 ms | 403.09 ms | 83.50 ms |
| 0eaac1e | 316.82 ms | 357.34 ms | 40.52 ms |
| 22ff2c7 | 306.60 ms | 336.65 ms | 30.05 ms |
| d15471f | 286.65 ms | 314.68 ms | 28.03 ms |
| 05aa61d | 310.43 ms | 372.40 ms | 61.97 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 0 B | 0 B | 0 B |
| e63ad34 | 0 B | 0 B | 0 B |
| 5865051 | 0 B | 0 B | 0 B |
| a1eadfa | 0 B | 0 B | 0 B |
| b193867 | 1.58 MiB | 2.19 MiB | 620.00 KiB |
| 0eaac1e | 1.58 MiB | 2.19 MiB | 619.17 KiB |
| 22ff2c7 | 0 B | 0 B | 0 B |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 05aa61d | 0 B | 0 B | 0 B |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
There was a problem hiding this comment.
Pull request overview
Adds support for recording segment names (transaction names) in Session Replay so replay events can be queried by the named segment(s) that occurred during each replay segment.
Changes:
- Extend the
ReplayControllerAPI withregisterSegmentName, and register transaction names fromSentryClient.captureTransaction. - Persist segment names in
SentryReplayEventpayloads assegment_names(including serialization/deserialization support). - Track, deduplicate, cap (100), and clear segment names per replay segment in the Android replay capture strategies, with added tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sentry/src/test/resources/json/sentry_replay_event.json | Updates replay event golden JSON to include segment_names. |
| sentry/src/test/java/io/sentry/SentryClientTest.kt | Adds/updates tests to verify segment name registration via ReplayController. |
| sentry/src/test/java/io/sentry/protocol/SentryReplayEventSerializationTest.kt | Ensures replay event protocol round-trip includes segmentNames. |
| sentry/src/main/java/io/sentry/SentryReplayEvent.java | Adds segmentNames field with JSON key segment_names plus (de)serialization and equality updates. |
| sentry/src/main/java/io/sentry/SentryClient.java | Registers captured transaction name with replay controller when a transaction is successfully sent. |
| sentry/src/main/java/io/sentry/ReplayController.java | Adds new internal API hook registerSegmentName. |
| sentry/src/main/java/io/sentry/NoOpReplayController.java | Implements the new no-op registerSegmentName method. |
| sentry/api/sentry.api | Updates public API dump for ReplayController, NoOpReplayController, and SentryReplayEvent. |
| sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt | Adds tests for deduplication, limit, and per-segment clearing of segment names. |
| sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt | Forwards registerSegmentName to the active capture strategy when recording. |
| sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt | Extends internal replay segment creation flow to include segmentNames. |
| sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt | Implements collection/dedup/limit/clear logic for segment names alongside trace IDs. |
| sentry-android-replay/api/sentry-android-replay.api | Updates Android replay module API dump for ReplayIntegration. |
| CHANGELOG.md | Adds an unreleased changelog entry for the new replay segment name capability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Record transaction segment names on replay events so replays can be queried by the named transaction that occurred during each segment.
This is needed in Sentry Flutter to report segment names that occurred during replays. (getsentry/sentry-dart#3865)
Replay context
Adds
ReplayController.registerSegmentName, collects unique names alongside trace IDs with the same 100-value limit, and clears both collections when a replay segment is created. Successfully captured native transactions register their transaction name automatically.Payload
Replay events now serialize and deserialize the collected names as
segment_names, with coverage for protocol round trips, deduplication, limits, and per-segment clearing.Related work in Sentry Javascript getsentry/sentry-javascript#21851
Requested by Gino Buenaflor via Junior.
--
View Junior Session in Sentry